Class MCollective::Logger::Syslog_logger
In: lib/mcollective/logger/syslog_logger.rb
Parent: Base

Impliments a syslog based logger using the standard ruby syslog class

Methods

Included Modules

Syslog::Constants

Public Instance methods

[Source]

    # File lib/mcollective/logger/syslog_logger.rb, line 30
30:             def log(level, from, msg)
31:                 if @known_levels.index(level) >= @known_levels.index(@active_level)
32:                     Syslog.send(map_level(level), "#{from} #{msg}")
33:                 end
34:             rescue
35:                 # if this fails we probably cant show the user output at all,
36:                 # STDERR it as last resort
37:                 STDERR.puts("#{level}: #{msg}")
38:             end

[Source]

    # File lib/mcollective/logger/syslog_logger.rb, line 18
18:             def set_logging_level(level)
19:                 # noop
20:             end

[Source]

    # File lib/mcollective/logger/syslog_logger.rb, line 9
 9:             def start
10:                 config = Config.instance
11: 
12:                 Syslog.close if Syslog.opened?
13:                 Syslog.open(File.basename($0))
14: 
15:                 set_level(config.loglevel.to_sym)
16:             end

[Source]

    # File lib/mcollective/logger/syslog_logger.rb, line 22
22:             def valid_levels
23:                 {:info  => :info,
24:                  :warn  => :warning,
25:                  :debug => :debug,
26:                  :fatal => :crit,
27:                  :error => :err}
28:             end

[Validate]