lib/syslogger.rb in syslogger-1.5.0 vs lib/syslogger.rb in syslogger-1.5.1
- old
+ new
@@ -2,13 +2,13 @@
require 'logger'
require 'thread'
class Syslogger
- VERSION = "1.5.0"
+ VERSION = "1.5.1"
- attr_reader :level, :ident, :options, :facility, :max_octets
+ attr_reader :level, :ident, :options, :facility, :max_octets, :formatter
MAPPING = {
Logger::DEBUG => Syslog::LOG_DEBUG,
Logger::INFO => Syslog::LOG_INFO,
Logger::WARN => Syslog::LOG_WARNING,
@@ -44,10 +44,11 @@
@ident = ident
@options = options || (Syslog::LOG_PID | Syslog::LOG_CONS)
@facility = facility
@level = Logger::INFO
@mutex = Mutex.new
+ @formatter = Logger::Formatter.new
end
%w{debug info warn error fatal unknown}.each do |logger_method|
# Accepting *args as message could be nil.
# Default params not supported in ruby 1.8.7
@@ -79,11 +80,11 @@
# +message+:: the message string.
# If nil, the method will call the block and use the result as the message string.
# If both are nil or no block is given, it will use the progname as per the behaviour of both the standard Ruby logger, and the Rails BufferedLogger.
# +progname+:: optionally, overwrite the program name that appears in the log message.
def add(severity, message = nil, progname = nil, &block)
- if message.nil? && block.nil? && !progname.nil?
- message, progname = progname, nil
+ if message.nil? && block.nil? && !progname.nil?
+ message, progname = progname, nil
end
progname ||= @ident
@mutex.synchronize do
Syslog.open(progname, @options, @facility) do |s|