class Logging::Layouts::Basic

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.

Public Instance Methods

format( event ) click to toggle source

Returns a string representation of the given logging event. See the class documentation for details about the formatting used.

# File lib/logging/layouts/basic.rb, line 30
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