Class: Wicoris::Postman::Logger
- Inherits:
-
Object
- Object
- Wicoris::Postman::Logger
- Defined in:
- lib/wicoris/postman/logger.rb
Instance Method Summary collapse
- #error(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
4 5 6 |
# File 'lib/wicoris/postman/logger.rb', line 4 def initialize STDOUT.sync = true end |
Instance Method Details
#error(msg) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/wicoris/postman/logger.rb', line 18 def error(msg) event = msg.merge( :level => :error, :timestamp => Time.now.iso8601 ) puts event.to_json end |
#info(msg) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/wicoris/postman/logger.rb', line 8 def info(msg) event = msg.merge( :level => :info, :timestamp => Time.now.iso8601 ) puts event.to_json rescue JSON::ParserError puts event.inspect end |