Class: Rapns::Daemon::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/rapns/daemon/logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Logger

Returns a new instance of Logger.



4
5
6
7
8
9
# File 'lib/rapns/daemon/logger.rb', line 4

def initialize(options)
  @options = options
  log_path = File.join(Rails.root, 'log', 'rapns.log')
  @logger = ActiveSupport::BufferedLogger.new(log_path, Rails.logger.level)
  @logger.auto_flushing = Rails.logger.respond_to?(:auto_flushing) ? Rails.logger.auto_flushing : true
end

Instance Method Details

#error(msg, options = {}) ⇒ Object



15
16
17
18
# File 'lib/rapns/daemon/logger.rb', line 15

def error(msg, options = {})
  airbrake_notify(msg) if notify_via_airbrake?(msg, options)
  log(:error, msg, 'ERROR')
end

#info(msg) ⇒ Object



11
12
13
# File 'lib/rapns/daemon/logger.rb', line 11

def info(msg)
  log(:info, msg)
end

#warn(msg) ⇒ Object



20
21
22
# File 'lib/rapns/daemon/logger.rb', line 20

def warn(msg)
  log(:warn, msg, 'WARNING')
end