lib/loggability.rb in loggability-0.2.0 vs lib/loggability.rb in loggability-0.2.1

- old
+ new

@@ -7,28 +7,24 @@ # A mixin that provides a top-level logging subsystem based on Logger. module Loggability # Package version constant - VERSION = '0.2.0' + VERSION = '0.2.1' # VCS revision - REVISION = %q$Revision: 4c9840dcb9fd $ + REVISION = %q$Revision: 3d9dced14889 $ # The key for the global logger (Loggability's own logger) GLOBAL_KEY = :__global__ # The methods that are delegated across all loggers AGGREGATE_METHODS = [ :level=, :output_to, :write_to, :format_with, :format_as, :formatter= ] # Configuration defaults CONFIG_DEFAULTS = { - :defaults => { - :severity => 'warn', - :formatter => 'default', - :output => 'STDERR', - }, + :__default__ => 'warn STDERR', } # Regexp for parsing logspec lines in the config LOGSPEC_PATTERN = %r{ ^ @@ -291,20 +287,21 @@ ### Configurability API -- configure logging. def self::configure( config=nil ) if config self.log.debug "Configuring Loggability with custom config." + confighash = config.to_hash # Set up all loggers with defaults first - if defaultspec = config.delete( :__default__ ) || config.delete( '__default__' ) + if defaultspec = confighash.delete( :__default__ ) || confighash.delete( '__default__' ) level, format, target = self.parse_config_spec( defaultspec ) Loggability.level = level if level Loggability.format_as( format ) if format Loggability.output_to( target ) if target end # Then let individual configs override. - config.each do |key, logspec| + confighash.each do |key, logspec| unless Loggability.log_host?( key ) self.log.debug " no such log host %p; skipping" % [ key ] next end