Class: Log4r::JSONFormatter::Base
- Inherits:
-
BasicFormatter
- Object
- BasicFormatter
- Log4r::JSONFormatter::Base
- Includes:
- LogFormatter::Common
- Defined in:
- lib/log_formatter/log4r_json_formatter.rb
Instance Method Summary collapse
- #format(event) ⇒ Object
-
#initialize(app = nil, ext = {}) {|@config| ... } ⇒ Base
constructor
A new instance of Base.
Methods included from LogFormatter::Common
#build_event, #current_time, #msg2str
Constructor Details
#initialize(app = nil, ext = {}) {|@config| ... } ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/log_formatter/log4r_json_formatter.rb', line 10 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? super() end |
Instance Method Details
#format(event) ⇒ Object
25 26 27 |
# File 'lib/log_formatter/log4r_json_formatter.rb', line 25 def format(event) @event = build_event(event.data, Log4r::LNAMES[event.level], nil, event.name) end |