lib/syslogger.rb in syslogger-1.3.0 vs lib/syslogger.rb in syslogger-1.4.0

- old
+ new

@@ -2,20 +2,20 @@ require 'logger' require 'thread' class Syslogger - VERSION = "1.3.0" + VERSION = "1.4.0" attr_reader :level, :ident, :options, :facility MAPPING = { Logger::DEBUG => Syslog::LOG_DEBUG, Logger::INFO => Syslog::LOG_INFO, - Logger::WARN => Syslog::LOG_NOTICE, - Logger::ERROR => Syslog::LOG_WARNING, - Logger::FATAL => Syslog::LOG_ERR, + Logger::WARN => Syslog::LOG_WARNING, + Logger::ERROR => Syslog::LOG_ERR, + Logger::FATAL => Syslog::LOG_CRIT, Logger::UNKNOWN => Syslog::LOG_ALERT } # # Initializes default options for the logger @@ -108,10 +108,11 @@ protected # Borrowed from SyslogLogger. def clean(message) message = message.to_s.dup - message.strip! + message.strip! # remove whitespace + message.gsub!(/\n/, '\\n') # escape newlines message.gsub!(/%/, '%%') # syslog(3) freaks on % (printf) message.gsub!(/\e\[[^m]*m/, '') # remove useless ansi color codes message end end