Release Name: 1.1.0
Notes:
syslogoutputter fixed in following ways:
Unreported bug kept any formatter from being applied to syslog output.
syslogoutputter now automatically maps the default log4r log levels to the native syslog API instead of forcing the log4r levels to be customized via custom_levels, i.e. log4r using syslogoutputter is now compatible across all outputters and allows developers to define their own custom levels.
If a developer does not provide a levels mapper from their custom levels to syslog levels, all messages default to LOG_INFO syslog messages.
Mapping occurs after syslogoutputter has been created and custom_levels have been created by calling on Syslogoutputter instance.map_levels_by_name_to_syslog( { <customlogtypestring> => <syslogtypestring>, ... } )
e.g.
require 'log4r'
require 'log4r/configurator'
require 'log4r/formatter/patternformatter'
require 'log4r/outputter/syslogoutputter'
require 'syslog'
include Log4r
include Syslog::Constants
# This is how we specify our levels
Configurator.custom_levels "Foo", "Bar", "Baz"
l = Logger.new('custom levels')
slp = PatternFormatter.new( :pattern => '{%d} {%l} {%C} {%m}', :date_method => 'usec' )
sl = SyslogOutputter.new( 'sysloggertest',
{ :logopt => LOG_CONS | LOG_PID | LOG_PERROR,
:facility => LOG_LOCAL7,
:formatter => slp } )
sl.map_levels_by_name_to_syslog( { "Foo" => "DEBUG", "Bar" => "INFO", "Baz" => "ALERT" } )
l.add sl
...
Changes:
1.1.0
* syslogoutputter overhauled, compatible with older versions
* see example file syslogcustom.rb for usage until documented
* Fixed pre-existing bug where syslogoutputter would
* ignore using a formatter.
* Added Rakefile from Revolution Health version of log4r
|