Class: Zetto::Services::ZettoLogger
- Inherits:
-
Logger
- Object
- Logger
- Zetto::Services::ZettoLogger
- Includes:
- Singleton
- Defined in:
- lib/zetto/services/zetto_logger.rb
Instance Method Summary collapse
-
#formatter ⇒ Object
Optional, but good for prefixing timestamps automatically.
-
#initialize ⇒ ZettoLogger
constructor
A new instance of ZettoLogger.
Constructor Details
#initialize ⇒ ZettoLogger
Returns a new instance of ZettoLogger.
6 7 8 9 10 |
# File 'lib/zetto/services/zetto_logger.rb', line 6 def initialize super(Rails.root.join('log/rrd.log')) self.formatter = formatter() self end |
Instance Method Details
#formatter ⇒ Object
Optional, but good for prefixing timestamps automatically
13 14 15 16 17 18 19 |
# File 'lib/zetto/services/zetto_logger.rb', line 13 def formatter Proc.new { |severity, time, progname, msg| formatted_severity = sprintf("%-5s", severity.to_s) formatted_time = time.strftime("%Y-%m-%d %H:%M:%S") "[#{formatted_severity} #{formatted_time} #{$$}] #{msg.to_s.strip}\n" } end |