Module: Rootage::Log

Defined in:
lib/rootage/log.rb

Class Method Summary collapse

Class Method Details

.debug(msg, pos = caller(1).first, pid = Process.pid) ⇒ Object

Log the debug message.



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

def self.debug(msg, pos=caller(1).first, pid=Process.pid)
  logger.debug(msg, pos, pid) if logger
end

.error(msg, pos = caller(1).first, pid = Process.pid) ⇒ Object

Log the error message.



9
10
11
# File 'lib/rootage/log.rb', line 9

def self.error(msg, pos=caller(1).first, pid=Process.pid)
  logger.error(msg, pos, pid) if logger
end

.fatal(msg, pos = caller(1).first, pid = Process.pid) ⇒ Object

Log the fatal message. This level is used when system will go to shutdown.



4
5
6
# File 'lib/rootage/log.rb', line 4

def self.fatal(msg, pos=caller(1).first, pid=Process.pid)
  logger.fatal(msg, pos, pid) if logger
end

.get_logger_blockObject

Get a logger block to extract a logger object.



34
35
36
# File 'lib/rootage/log.rb', line 34

def self.get_logger_block
  @logger
end

.info(msg, pos = caller(1).first, pid = Process.pid) ⇒ Object

Log the info message.



19
20
21
# File 'lib/rootage/log.rb', line 19

def self.info(msg, pos=caller(1).first, pid=Process.pid)
  logger.info(msg, pos, pid) if logger
end

.loggerObject

Return the logger.



29
30
31
# File 'lib/rootage/log.rb', line 29

def self.logger
  @logger.call
end

.set_logger_block(&block) ⇒ Object

Set logger to use in Log interface.



39
40
41
# File 'lib/rootage/log.rb', line 39

def self.set_logger_block(&block)
  @logger = block
end

.terminateObject

Terminate the logger.



44
45
46
# File 'lib/rootage/log.rb', line 44

def self.terminate
  logger.terminate if logger
end

.warn(msg, pos = caller(1).first, pid = Process.pid) ⇒ Object

Log the warn message.



14
15
16
# File 'lib/rootage/log.rb', line 14

def self.warn(msg, pos=caller(1).first, pid=Process.pid)
  logger.warn(msg, pos, pid) if logger
end