Class: Airbrake::AirbrakeLogger
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Airbrake::AirbrakeLogger
- Defined in:
- lib/airbrake/logger.rb
Overview
Decorator for Logger
from stdlib. Endows loggers the ability to both log and report errors to Airbrake.
Instance Attribute Summary collapse
- #airbrake_level ⇒ Integer
-
#airbrake_notifier ⇒ Airbrake::Notifier
Notifier to be used to send notices.
Instance Method Summary collapse
- #error(progname = nil, &block) ⇒ Object
- #fatal(progname = nil, &block) ⇒ Object
-
#initialize(logger) ⇒ AirbrakeLogger
constructor
A new instance of AirbrakeLogger.
- #level=(value) ⇒ Object
- #unknown(progname = nil, &block) ⇒ Object
- #warn(progname = nil, &block) ⇒ Object
Constructor Details
#initialize(logger) ⇒ AirbrakeLogger
Returns a new instance of AirbrakeLogger.
26 27 28 29 30 31 32 |
# File 'lib/airbrake/logger.rb', line 26 def initialize(logger) super __setobj__(logger) @airbrake_notifier = Airbrake self.level = logger.level end |
Instance Attribute Details
#airbrake_level ⇒ Integer
24 25 26 |
# File 'lib/airbrake/logger.rb', line 24 def airbrake_level @airbrake_level end |
#airbrake_notifier ⇒ Airbrake::Notifier
Returns notifier to be used to send notices.
21 22 23 |
# File 'lib/airbrake/logger.rb', line 21 def airbrake_notifier @airbrake_notifier end |
Instance Method Details
#error(progname = nil, &block) ⇒ Object
41 42 43 44 |
# File 'lib/airbrake/logger.rb', line 41 def error(progname = nil, &block) notify_airbrake(Logger::ERROR, progname) super end |
#fatal(progname = nil, &block) ⇒ Object
47 48 49 50 |
# File 'lib/airbrake/logger.rb', line 47 def fatal(progname = nil, &block) notify_airbrake(Logger::FATAL, progname) super end |
#level=(value) ⇒ Object
59 60 61 62 |
# File 'lib/airbrake/logger.rb', line 59 def level=(value) self.airbrake_level = value < Logger::WARN ? Logger::WARN : value super end |
#unknown(progname = nil, &block) ⇒ Object
53 54 55 56 |
# File 'lib/airbrake/logger.rb', line 53 def unknown(progname = nil, &block) notify_airbrake(Logger::UNKNOWN, progname) super end |
#warn(progname = nil, &block) ⇒ Object
35 36 37 38 |
# File 'lib/airbrake/logger.rb', line 35 def warn(progname = nil, &block) notify_airbrake(Logger::WARN, progname) super end |