class NRSER::Log::Logger::Catcher
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.
Public Class Methods
new(logger, on_fail: nil)
click to toggle source
Instantiate a new `Catcher`.
@param [NRSER::Log::Logger] logger
The logger to use if the block raises.
@param [*] on_fail
Value to return when `&block` raises.
# File lib/nrser/log/logger.rb, line 49 def initialize logger, on_fail: nil @logger = logger @on_fail = on_fail end