Class: DispatchRider::Logging::LifecycleLogger
- Inherits:
-
Object
- Object
- DispatchRider::Logging::LifecycleLogger
- Defined in:
- lib/dispatch-rider/logging/lifecycle_logger.rb
Class Method Summary collapse
- .log_error_handler_fail(message, exception) ⇒ Object
- .log_got_stop(reason, message) ⇒ Object
- .wrap_handling(message) ⇒ Object
Instance Method Summary collapse
-
#initialize(kind, message, options = {}) ⇒ LifecycleLogger
constructor
A new instance of LifecycleLogger.
- #log ⇒ Object
Constructor Details
#initialize(kind, message, options = {}) ⇒ LifecycleLogger
Returns a new instance of LifecycleLogger.
46 47 48 49 50 |
# File 'lib/dispatch-rider/logging/lifecycle_logger.rb', line 46 def initialize(kind, , = {}) @kind = kind = = end |
Class Method Details
.log_error_handler_fail(message, exception) ⇒ Object
7 8 9 |
# File 'lib/dispatch-rider/logging/lifecycle_logger.rb', line 7 def log_error_handler_fail(, exception) new(:error_handler_fail, , exception: exception).log end |
.log_got_stop(reason, message) ⇒ Object
11 12 13 |
# File 'lib/dispatch-rider/logging/lifecycle_logger.rb', line 11 def log_got_stop(reason, ) new(:stop, , reason: reason).log end |
.wrap_handling(message) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dispatch-rider/logging/lifecycle_logger.rb', line 15 def wrap_handling() start_time = Time.now log_start() yield log_success() rescue => exception log_fail(, exception) raise exception ensure log_complete(, Time.now - start_time) end |
Instance Method Details
#log ⇒ Object
52 53 54 |
# File 'lib/dispatch-rider/logging/lifecycle_logger.rb', line 52 def log logger.send(log_action, formatted_data) end |