Class: Logging::Layouts::Basic
- Inherits:
-
Logging::Layout
- Object
- Logging::Layout
- Logging::Layouts::Basic
- Defined in:
- lib/logging/layouts/basic.rb
Overview
The Basic
layout class provides methods for simple formatting of log events. The resulting string follows the format below.
LEVEL LoggerName : log message
LEVEL is the log level of the event. LoggerName is the name of the logger that generated the event. log message is the message or object that was passed to the logger. If multiple message or objects were passed to the logger then each will be printed on its own line with the format show above.
Instance Method Summary collapse
-
#format(event) ⇒ Object
call-seq: format( event ).
Methods inherited from Logging::Layout
#footer, #format_obj, #header, #initialize, #try_yaml
Constructor Details
This class inherits a constructor from Logging::Layout
Instance Method Details
#format(event) ⇒ Object
call-seq:
format( event )
Returns a string representation of the given logging event. See the class documentation for details about the formatting used.
23 24 25 26 27 |
# File 'lib/logging/layouts/basic.rb', line 23 def format( event ) obj = format_obj(event.data) sprintf("%*s %s : %s\n", ::Logging::MAX_LEVEL_LENGTH, ::Logging::LNAMES[event.level], event.logger, obj) end |