Class: PuppetTwitch::Logger

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

Overview

Logger just prints to STDOUT. When the server is running in the foreground (not Daemonized), all output is visible in the terminal. When the server is running as a Daemon, STDOUT is redirected to a logfile, so this simple logger works for both scenarios

Constant Summary collapse

DEBUG =
0
INFO =
1
WARN =
2
ERROR =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level = INFO) ⇒ Logger

Returns a new instance of Logger.



19
20
21
# File 'lib/puppet_twitch/logger.rb', line 19

def initialize(level = INFO)
  @level = level
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



17
18
19
# File 'lib/puppet_twitch/logger.rb', line 17

def level
  @level
end

Instance Method Details

#debug(message) ⇒ Object



23
24
25
# File 'lib/puppet_twitch/logger.rb', line 23

def debug(message)
  log DEBUG, "Log [DEBUG]: #{message}"
end

#error(message) ⇒ Object



32
33
34
# File 'lib/puppet_twitch/logger.rb', line 32

def error(message)
  log ERROR, "Log [ERROR]: #{message}"
end

#info(message) ⇒ Object



26
27
28
# File 'lib/puppet_twitch/logger.rb', line 26

def info(message)
  log INFO, "Log [INFO]: #{message}"
end

#warn(message) ⇒ Object



29
30
31
# File 'lib/puppet_twitch/logger.rb', line 29

def warn(message)
  log WARN, "Log [WARN]: #{message}"
end