Loggability::
Logger class
| Superclass | Logger | 
A subclass of Logger that provides additional API for configuring outputters, formatters, etc.
Constants
- DEFAULT_DEVICE
 Default log ‘device’
- DEFAULT_SHIFT_AGE
 Default ‘shift age’
- DEFAULT_SHIFT_SIZE
 Default ‘shift size’
Attributes
- created_from R
 The line that caused this logger to be created.
Public Class Methods
Return an equivalent Loggability::Logger object for the given logger.
Create a new Logger wrapper that will output to the specified logdev.
Public Instance Methods
Append operator – Override Logger’s append so log messages always have formatting, and are always appended at :debug level.
Log a message if the severity is high enough. Overridden to account for the overridden level.
Return a human-readable representation of the object suitable for debugging.
Restore the level, logdev, and formatter from the given settings.
Return a Hash that contains its settings suitable for restoration via restore_settings later.
Rack::CommonLogger compatibility method – append a message at ‘info’ level.
Output Device
↑ topAttributes
- logdev RW
 The raw log device
Public Instance Methods
Change the log device to log to target instead of what it was before. Any additional args are passed to the LogDevice’s constructor. In addition to Logger’s support for logging to IO objects and files (given a filename in a String), this method can also set up logging to any object that responds to <<.
Output Formatting API
↑ topPublic Instance Methods
Format a log message using the current formatter and return it.
Return the formatted name of the given severity.
Set a new formatter for the logger. If formatter is nil or :default, this causes the logger to fall back to its default formatter. If it’s a Symbol other than :default, it looks for a similarly-named formatter under loggability/formatter/ and uses that. If formatter is an object that responds to call (e.g., a Proc or a Method object), that object is used directly.
Procs and methods should have the method signature: (severity, datetime, progname, msg).
# Load and use the HTML formatter MyProject.logger.format_with( :html ) # Call self.format_logmsg(...) to format messages MyProject.logger.format_with( self.method(:format_logmsg) ) # Reset to the default MyProject.logger.format_with( :default )
Return the current formatter used to format log messages.
Progname Proxy
↑ topPublic Instance Methods
Create a logging proxy for object that will include its name as the ‘progname’ of each message.
Severity Level
↑ topPublic Instance Methods
Sets the log level to :debug.
Returns true if the log level allows entries with severity :debug to be written, false otherwise.
Sets the log level to :error.
Returns true if the log level allows entries with severity :error to be written, false otherwise.
Sets the log level to :fatal.
Returns true if the log level allows entries with severity :fatal to be written, false otherwise.
Sets the log level to :info.
Returns true if the log level allows entries with severity :info to be written, false otherwise.
Return the logger’s level as a Symbol.
Set the logger level to newlevel, which can be a numeric level (e.g., Logger::DEBUG, etc.), or a symbolic level (e.g., :debug, :info, etc.)
Sets the log level to :warn.
Returns true if the log level allows entries with severity :warn to be written, false otherwise.