Class: Rpush::Logger
- Inherits:
-
Object
- Object
- Rpush::Logger
- Defined in:
- lib/rpush/logger.rb
Instance Method Summary collapse
- #error(msg, inline = false) ⇒ Object
- #info(msg, inline = false) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #warn(msg, inline = false) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/rpush/logger.rb', line 3 def initialize FileUtils.mkdir_p(File.dirname(Rpush.config.log_file)) log = File.open(Rpush.config.log_file, 'a') log.sync = true setup_logger(log) rescue Errno::ENOENT, Errno::EPERM => e @logger = nil error(e) error('Logging disabled.') end |
Instance Method Details
#error(msg, inline = false) ⇒ Object
18 19 20 |
# File 'lib/rpush/logger.rb', line 18 def error(msg, inline = false) log(:error, msg, inline, 'ERROR', STDERR) end |
#info(msg, inline = false) ⇒ Object
14 15 16 |
# File 'lib/rpush/logger.rb', line 14 def info(msg, inline = false) log(:info, msg, inline) end |
#warn(msg, inline = false) ⇒ Object
22 23 24 |
# File 'lib/rpush/logger.rb', line 22 def warn(msg, inline = false) log(:warn, msg, inline, 'WARNING', STDERR) end |