Class: Jerakia::Log

Inherits:
Jerakia show all
Defined in:
lib/jerakia/log.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jerakia

#add_to_filecache, #config, config, crit, fatal, filecache, #log, log, #lookup

Constructor Details

#initialize(level = :info) ⇒ Log

Returns a new instance of Log.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/jerakia/log.rb', line 4

def initialize(level=:info)
  @@logfile ||= config[:logfile] || '/var/log/jerakia.log'
  @@logger ||= Logger.new(@@logfile)
  @@level ||= level
  case @@level
  when :info
    @@logger.level = Logger::INFO
  when :debug
    @@logger.level = Logger::DEBUG
  end
end

Class Method Details

.debug(msg) ⇒ Object

def self.fatal(msg) self.new.fatal msg end

def self.error(msg) self.new.error msg end



40
41
42
# File 'lib/jerakia/log.rb', line 40

def self.debug(msg)
  self.new.debug msg
end

Instance Method Details

#debug(msg) ⇒ Object



20
21
22
# File 'lib/jerakia/log.rb', line 20

def debug(msg)
  @@logger.debug msg
end

#error(msg) ⇒ Object



24
25
26
# File 'lib/jerakia/log.rb', line 24

def error(msg)
  @@logger.error msg
end

#fatal(msg) ⇒ Object



28
29
30
# File 'lib/jerakia/log.rb', line 28

def fatal(msg)
  @@logger.fatal msg
end

#info(msg) ⇒ Object



16
17
18
# File 'lib/jerakia/log.rb', line 16

def info(msg)
  @@logger.info msg
end