Class: WebMonitor::Logger
- Inherits:
-
Object
- Object
- WebMonitor::Logger
- Defined in:
- lib/web-monitor/logger.rb
Instance Method Summary collapse
- #close ⇒ Object
- #error(msg) ⇒ Object
- #fatal(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize(config) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(config) ⇒ Logger
Returns a new instance of Logger.
5 6 7 8 9 10 11 |
# File 'lib/web-monitor/logger.rb', line 5 def initialize(config) @log = ::Logger.new(config.log_file) @log.datetime_format = "%Y-%m-%d %H:%M:%S" @log.formatter = proc do |severity, datetime, progname, msg| "#{datetime} #{severity} #{msg}\n" end end |
Instance Method Details
#close ⇒ Object
25 26 27 |
# File 'lib/web-monitor/logger.rb', line 25 def close @log.close end |
#error(msg) ⇒ Object
17 18 19 |
# File 'lib/web-monitor/logger.rb', line 17 def error(msg) @log.error(msg) end |
#fatal(msg) ⇒ Object
21 22 23 |
# File 'lib/web-monitor/logger.rb', line 21 def fatal(msg) @log.fatal(msg) end |
#info(msg) ⇒ Object
13 14 15 |
# File 'lib/web-monitor/logger.rb', line 13 def info(msg) @log.info(msg) end |