Class: Wicoris::Postman::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/wicoris/postman/logger.rb

Instance Method Summary collapse

Constructor Details

#initializeLogger

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