Class MCollective::Log
In: lib/mcollective/log.rb
Parent: Object

A simple singleton class that allows logging at various levels.

Methods

cycle_level   debug   error   fatal   info   new   warn  

Included Modules

Singleton

Public Class methods

[Source]

    # File lib/mcollective/log.rb, line 8
 8:         def initialize
 9:             config = Config.instance
10:             raise ("Configuration has not been loaded, can't start logger") unless config.configured
11: 
12:             require "mcollective/logger/#{config.logger_type.downcase}_logger"
13:             @logger = eval("MCollective::Logger::#{config.logger_type.capitalize}_logger.new")
14: 
15:             @logger.start
16:         rescue Exception => e
17:             STDERR.puts "Could not start logger: #{e.class} #{e}"
18:         end

Public Instance methods

[Source]

    # File lib/mcollective/log.rb, line 20
20:         def cycle_level
21:             @logger.cycle_level
22:         end

Logs at debug level

[Source]

    # File lib/mcollective/log.rb, line 35
35:         def debug(msg)
36:             @logger.log(:debug, from, msg)
37:         end

Logs at error level

[Source]

    # File lib/mcollective/log.rb, line 45
45:         def error(msg)
46:             @logger.log(:error, from, msg)
47:         end

Logs at fatal level

[Source]

    # File lib/mcollective/log.rb, line 40
40:         def fatal(msg)
41:             @logger.log(:fatal, from, msg)
42:         end

Logs at info level

[Source]

    # File lib/mcollective/log.rb, line 25
25:         def info(msg)
26:             @logger.log(:info, from, msg)
27:         end

Logs at warn level

[Source]

    # File lib/mcollective/log.rb, line 30
30:         def warn(msg)
31:             @logger.log(:warn, from, msg)
32:         end

[Validate]