lib/loggability.rb in loggability-0.15.1 vs lib/loggability.rb in loggability-0.16.0
- old
+ new
@@ -7,11 +7,11 @@
# A mixin that provides a top-level logging subsystem based on Logger.
module Loggability
# Package version constant
- VERSION = '0.15.1'
+ VERSION = '0.16.0'
# The key for the global logger (Loggability's own logger)
GLOBAL_KEY = :__global__
# The methods that are delegated across all loggers
@@ -27,25 +27,31 @@
^
\s*
(?<severity>(?i:debug|info|warn|error|fatal))
(?:
\s+
- (?<target>(?:[\w\-/:\.]|\\[ ])+)
+ (?<target>(?:[\w\-/:\.\[\]]|\\[ ])+)
)?
(?: \s+\(
(?<format>\w+)
\) )?
\s*
$
}x
- require 'loggability/constants'
- include Loggability::Constants
- require 'loggability/logger'
+ # Automatically load subordinate classes/modules
+ autoload :Constants, 'loggability/constants'
+ autoload :LogDevice, 'loggability/log_device'
+ autoload :Logger, 'loggability/logger'
+ autoload :LogHost, 'loggability/loghost'
+ autoload :LogClient, 'loggability/logclient'
+ autoload :Override, 'loggability/override'
+ include Loggability::Constants
+
##
# The Hash of modules that have a Logger, keyed by the name they register with
class << self; attr_reader :log_hosts; end
@log_hosts = {}
@@ -53,14 +59,10 @@
# The last logging configuration that was installed
class << self; attr_accessor :config; end
@config = CONFIG_DEFAULTS.dup.freeze
- # Automatically log the log host and log client mixins when they're referenced
- autoload :LogHost, 'loggability/loghost'
- autoload :LogClient, 'loggability/logclient'
- autoload :Override, 'loggability/override'
### Cast the given +device+ to a Loggability::Logger, if possible, and return it. If
### it can't be converted, raises a ArgumentError.
def self::Logger( device )
@@ -319,9 +321,10 @@
severity, target, format = match.captures
target = case target
when 'STDOUT' then $stdout
when 'STDERR' then $stderr
+ when /:/ then Loggability::LogDevice.parse_device_spec( target )
else
target
end
return severity, format, target