Class: Rage::LogProcessor
- Inherits:
-
Object
- Object
- Rage::LogProcessor
- Defined in:
- lib/rage/log_processor.rb
Instance Attribute Summary collapse
-
#dynamic_context ⇒ Object
readonly
Returns the value of attribute dynamic_context.
-
#dynamic_tags ⇒ Object
readonly
Returns the value of attribute dynamic_tags.
Instance Method Summary collapse
- #add_custom_context(context_objects) ⇒ Object
- #add_custom_tags(tag_objects) ⇒ Object
- #finalize_request_logger(env, response, params) ⇒ Object
-
#initialize ⇒ LogProcessor
constructor
A new instance of LogProcessor.
Constructor Details
#initialize ⇒ LogProcessor
Returns a new instance of LogProcessor.
9 10 11 |
# File 'lib/rage/log_processor.rb', line 9 def initialize rebuild! end |
Instance Attribute Details
#dynamic_context ⇒ Object (readonly)
Returns the value of attribute dynamic_context.
7 8 9 |
# File 'lib/rage/log_processor.rb', line 7 def dynamic_context @dynamic_context end |
#dynamic_tags ⇒ Object (readonly)
Returns the value of attribute dynamic_tags.
7 8 9 |
# File 'lib/rage/log_processor.rb', line 7 def @dynamic_tags end |
Instance Method Details
#add_custom_context(context_objects) ⇒ Object
13 14 15 16 |
# File 'lib/rage/log_processor.rb', line 13 def add_custom_context(context_objects) @custom_context = context_objects rebuild! end |
#add_custom_tags(tag_objects) ⇒ Object
18 19 20 21 |
# File 'lib/rage/log_processor.rb', line 18 def (tag_objects) @custom_tags = tag_objects rebuild! end |
#finalize_request_logger(env, response, params) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rage/log_processor.rb', line 23 def finalize_request_logger(env, response, params) logger = Thread.current[:rage_logger] duration = ( (Process.clock_gettime(Process::CLOCK_MONOTONIC) - logger[:request_start]) * 1000 ).round(2) logger[:final] = { env:, params:, response:, duration: } Rage.logger.info(nil) logger[:final] = nil end |