Loggability module
| Included Modules |
A mixin that provides a top-level logging subsystem based on Logger.
Constants
- AGGREGATE_METHODS
The methods that are delegated across all loggers
- CONFIG_DEFAULTS
Configuration defaults
- GLOBAL_KEY
The key for the global logger (Loggability’s own logger)
- LOGSPEC_PATTERN
Regexp for parsing logspec lines in the config
- VERSION
Package version constant
Attributes
- config RW
- log_hosts R
Public Class Methods
Cast the given device to a Loggability::Logger, if possible, and return it. If it can’t be converted, raises a ArgumentError.
Return the Loggability::Logger for the loghost associated with logclient.
Returns true if there is a log host associated with the given object.
Return the log host for object, if any. Raises an ArgumentError if the object doesn’t have an associated log host.
Return the log host key for object, using its log_host_key method if it has one, or returning it as a Symbol if it responds to to_sym. Returns nil if no key could be derived.
Register the specified host as a log host. It should already have been extended with LogHostMethods.
Clear out all registered log hosts and reset the default logger. This is mostly intended for facilitating tests.
Aggregate Methods
↑ topPublic Class Methods
Call the method with the given methodname across the loggers of all loghosts with the given arg and/or block.
Aggregate method: override one or more settings for the duration of the block for only the given hosts. If no block is given returns a Loggability::Override object that will override the specified log hosts whenever its #call method is called.
formatter = formatter
:method: format_with
Aggregate method: set all loggers to log with the given formatter. See Loggability::Logger#format_with for more info.
Aggregate method: set all loggers to log with the given formatter for the duration of the block, restoring the original formatters afterward. If no block is given, returns a Loggability::Override object that will override all formatters whenever its #call method is called.
:method: level=
Aggregate method: set the log level on all loggers to newlevel. See Loggability::Logger#level= for more info.
:method: output_to
Aggregate method: set all loggers to log to destination. See Loggability::Logger#output_to for more info.
Aggregate method: set all loggers to log to destination for the duration of the block, restoring the original destination afterward. If no block is given, returns a Loggability::Override object that will log to destination whenever its #call method is called.
Aggregate method: set the log level on all loggers to level for the duration of the block, restoring the original levels afterward. If no block is given, returns a Loggability::Override object that set the log level to level while its #call method is being called.
Configurability Support
↑ topPublic Class Methods
Configure the specified logger (or anything that ducktypes the same) with the configuration specified by logspec.
Configurability API – configure logging.
Parse the specified spec into level,
LogClient API
↑ topPublic Instance Methods
Register as a log client 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 can be written to the loghost via the LogClient API, which is automatically included.
LogHost API
↑ topPublic Instance Methods
Register as a log host associated with the given key, add the methods from LogHost, and install a Loggability::Logger.