Class: Logcraft::LogLayout
- Inherits:
-
Logging::Layout
- Object
- Logging::Layout
- Logcraft::LogLayout
- Defined in:
- lib/logcraft/log_layout.rb
Instance Method Summary collapse
- #format(event) ⇒ Object
-
#initialize(global_context = {}, options = {}) ⇒ LogLayout
constructor
A new instance of LogLayout.
Constructor Details
#initialize(global_context = {}, options = {}) ⇒ LogLayout
7 8 9 10 |
# File 'lib/logcraft/log_layout.rb', line 7 def initialize(global_context = {}, = {}) @global_context = global_context @level_formatter = .fetch :level_formatter, ->(level) { Logging::LNAMES[level] } end |
Instance Method Details
#format(event) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/logcraft/log_layout.rb', line 12 def format(event) log_entry = background_of(event).merge evaluated_global_context, dynamic_log_context, (event.data) MultiJson.dump(log_entry) + "\n" end |