Class: WideLogger::DevFormatter

Inherits:
PaulBunyan::JSONFormatter
  • Object
show all
Defined in:
lib/wide_logger/dev_formatter.rb

Direct Known Subclasses

DevJsonFormatter

Instance Method Summary collapse

Constructor Details

#initialize(include_json: true) ⇒ DevFormatter

Returns a new instance of DevFormatter.



7
8
9
10
# File 'lib/wide_logger/dev_formatter.rb', line 7

def initialize(include_json: true)
  super()
  @include_json = include_json
end

Instance Method Details

#call(severity, time, progname, msg) ⇒ Object



12
13
14
15
16
17
# File 'lib/wide_logger/dev_formatter.rb', line 12

def call(severity, time, progname, msg)
  prefix = time.utc.strftime(DATETIME_FORMAT) + ' ' + msg.to_s
  return prefix + "\n" unless @include_json

  prefix + ' ' + super
end