Class: Rapns::Logger
- Inherits:
-
Object
- Object
- Rapns::Logger
- Defined in:
- lib/rapns/logger.rb
Instance Method Summary collapse
- #error(msg, options = {}) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize(options) ⇒ Logger
constructor
A new instance of Logger.
- #warn(msg) ⇒ Object
Constructor Details
#initialize(options) ⇒ Logger
Returns a new instance of Logger.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rapns/logger.rb', line 3 def initialize() @options = begin log = File.open(File.join(Rails.root, 'log', 'rapns.log'), 'a') log.sync = true setup_logger(log) rescue Errno::ENOENT, Errno::EPERM => e @logger = nil error(e) error('Logging disabled.') end end |
Instance Method Details
#error(msg, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/rapns/logger.rb', line 21 def error(msg, = {}) airbrake_notify(msg) if notify_via_airbrake?(msg, ) log(:error, msg, 'ERROR', STDERR) end |
#info(msg) ⇒ Object
17 18 19 |
# File 'lib/rapns/logger.rb', line 17 def info(msg) log(:info, msg) end |
#warn(msg) ⇒ Object
26 27 28 |
# File 'lib/rapns/logger.rb', line 26 def warn(msg) log(:warn, msg, 'WARNING', STDERR) end |