Class: RubyJSONFormatter::Base

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/log_formatter/ruby_json_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(app = nil, ext = {}) {|@config| ... } ⇒ Base

Returns a new instance of Base.

Yields:

  • (@config)


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/log_formatter/ruby_json_formatter.rb', line 7

def initialize(app = nil, ext = {})
  @app = app
  @ext = ext.is_a?(Hash) ? ext : {}
  @config = {
    level: :log_level,
    type: :log_type,
    app: :log_app,
    timestamp: :log_timestamp
  }

  yield @config if block_given?
end

Instance Method Details

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



20
21
22
# File 'lib/log_formatter/ruby_json_formatter.rb', line 20

def call(severity, time, progname, message)
  @event = build_event(message, severity, time, progname)
end