lib/loggability.rb in loggability-0.5.0 vs lib/loggability.rb in loggability-0.6.0
- old
+ new
@@ -7,14 +7,14 @@
# A mixin that provides a top-level logging subsystem based on Logger.
module Loggability
# Package version constant
- VERSION = '0.5.0'
+ VERSION = '0.6.0'
# VCS revision
- REVISION = %q$Revision: 0db162246900 $
+ REVISION = %q$Revision: 5475fac60ffb $
# The key for the global logger (Loggability's own logger)
GLOBAL_KEY = :__global__
# The methods that are delegated across all loggers
@@ -212,31 +212,10 @@
alias_method :log=, :logger=
end # module LogHost
- #
- # :section: LogHost API
- #
-
- ### Register as a log host associated with the given +key+, add the methods from
- ### LogHost, and install a Loggability::Logger.
- def log_as( key )
- self.extend( Loggability::LogHost )
- self.log_host_key = key.to_sym
- self.logger = self.default_logger = Loggability::Logger.new
- Loggability.register_loghost( self )
- end
-
- # Install a global logger in Loggability itself
- extend( Loggability::LogHost )
- self.log_host_key = GLOBAL_KEY
- self.logger = self.default_logger = Loggability::Logger.new
- Loggability.register_loghost( self )
-
-
-
# Methods to install for objects which call +log_to+.
module LogClient
##
# The key of the log host this client targets
@@ -278,10 +257,26 @@
end # module LogClient
#
+ # :section: LogHost API
+ #
+
+ ### Register as a log host associated with the given +key+, add the methods from
+ ### LogHost, and install a Loggability::Logger.
+ def log_as( key )
+ extend( Loggability::LogHost )
+ include( Loggability::LogClient::InstanceMethods ) if self.is_a?( Class )
+
+ self.log_host_key = key.to_sym
+ self.logger = self.default_logger = Loggability::Logger.new
+ Loggability.register_loghost( self )
+ end
+
+
+ #
# :section: LogClient API
#
### Register as a <b>log client</b> that will log to to the given +loghost+, which can be
### either the +key+ the host registered with, or the log host object itself. Log messages
@@ -290,9 +285,16 @@
extend( Loggability::LogClient )
include( Loggability::LogClient::InstanceMethods ) if self.is_a?( Class )
self.log_host_key = Loggability.log_host_key_for( loghost )
end
+
+
+ # Install a global logger in Loggability itself
+ extend( Loggability::LogHost )
+ self.log_host_key = GLOBAL_KEY
+ self.logger = self.default_logger = Loggability::Logger.new
+ Loggability.register_loghost( self )
#
# :section: Configurability Support
#