Class: NRSER::Log::Logger::Catcher
Overview
Class that points to a NRSER::Log::Logger and provides the log methods (‘#error`, `#warn`, … `#trace`) with an additional `&block` parameter.
Each of those methods calls the block in a ‘begin` / `rescue`, and if it raises, the log message will be dispatched with the raised error added.
Instance Method Summary collapse
-
#initialize(logger, on_fail: nil) ⇒ Catcher
constructor
Instantiate a new ‘Catcher`.
Constructor Details
#initialize(logger, on_fail: nil) ⇒ Catcher
Instantiate a new ‘Catcher`.
49 50 51 52 |
# File 'lib/nrser/log/logger.rb', line 49 def initialize logger, on_fail: nil @logger = logger @on_fail = on_fail end |