Class: Monitor::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_monitor/log.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, type = 'INFO') ⇒ Log

Returns a new instance of Log.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/chef_monitor/log.rb', line 21

def initialize(text, type='INFO')
  case type.downcase
  when "INFO".downcase
    puts "[" + Time.now.iso8601 + "] INFO: " + text
  when "WARN".downcase
    puts "[" + Time.now.iso8601 + "] WARN: " + text
  when "ERROR".downcase
    puts "[" + Time.now.iso8601 + "] ERROR: " + text
  when "DEBUG".downcase
    puts "[" + Time.now.iso8601 + "] DEBUG: " + text if DEBUG
  else
    puts "[" + Time.now.iso8601 + "] UNKNOWN: " + text
  end
end