Impliments a syslog based logger using the standard ruby syslog class
# File lib/mcollective/logger/syslog_logger.rb, line 30 def log(level, from, msg) if @known_levels.index(level) >= @known_levels.index(@active_level) Syslog.send(map_level(level), "#{from} #{msg}") end rescue # if this fails we probably cant show the user output at all, # STDERR it as last resort STDERR.puts("#{level}: #{msg}") end
# File lib/mcollective/logger/syslog_logger.rb, line 18 def set_logging_level(level) # noop end
# File lib/mcollective/logger/syslog_logger.rb, line 9 def start config = Config.instance Syslog.close if Syslog.opened? Syslog.open(File.basename($0)) set_level(config.loglevel.to_sym) end
# File lib/mcollective/logger/syslog_logger.rb, line 22 def valid_levels {:info => :info, :warn => :warning, :debug => :debug, :fatal => :crit, :error => :err} end