Module: Contrast::Logger::Time
- Defined in:
- lib/contrast/logger/time.rb
Overview
Our decorator for the Ougai logger allowing for timing and with_level methods.
Instance Method Summary collapse
-
#debug_with_time(*msgs, &block) ⇒ Object
Log, at the debug level, the action with a message including the time it took for the wrapped function to complete.
-
#trace_with_time(*msgs, &block) ⇒ Object
Log, at the trace level, the action with a message including the time it took for the wrapped function to complete.
-
#with_level(level, message) ⇒ Object
Log the message at the given level.
Instance Method Details
#debug_with_time(*msgs, &block) ⇒ Object
Log, at the debug level, the action with a message including the time it took for the wrapped function to complete. If not logging to debug, simply yield the given block.
23 24 25 26 27 28 29 |
# File 'lib/contrast/logger/time.rb', line 23 def debug_with_time *msgs, &block if debug? log_with_time(:debug, *msgs, &block) elsif block yield end end |
#trace_with_time(*msgs, &block) ⇒ Object
Log, at the trace level, the action with a message including the time it took for the wrapped function to complete. If not logging to debug, simply yield the given block.
37 38 39 40 41 42 43 |
# File 'lib/contrast/logger/time.rb', line 37 def trace_with_time *msgs, &block if trace? log_with_time(:trace, *msgs, &block) elsif block yield end end |
#with_level(level, message) ⇒ Object
Log the message at the given level.
13 14 15 |
# File 'lib/contrast/logger/time.rb', line 13 def with_level level, send(level.to_sym, ) end |