Class: StructuredLogger::ArgumentFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/structured_logger.rb

Instance Method Summary collapse

Instance Method Details

#call(severity: _, time: _, progname: _, args: args(), block_result: block_result(), **_) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/structured_logger.rb', line 71

def call(severity: _, time: _, progname: _,
         args: args(), block_result: block_result(),
         **_) # for ignoring future arguments
  if block_result
    # {foo: "bar"} => [{foo: bar}]
    # ["msg", {foo: "bar"}] => ["msg", {foo: "bar"}]
    *args_and_block_result = block_result
  else
    args_and_block_result = args
  end
  return format_body(*args_and_block_result)
end