Sha256: 1510ba3181325c1399902bf4ec35bc6434409ae7d3b3c921f4ccb39fee0e79b9

Contents?: true

Size: 1004 Bytes

Versions: 5

Compression:

Stored size: 1004 Bytes

Contents

module Logging::Layouts

  # 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. <em>log message</em> 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.
  #
  class Basic < ::Logging::Layout

    # call-seq:
    #    format( event )
    #
    # Returns a string representation of the given loggging _event_. See the
    # class documentation for details about the formatting used.
    #
    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

  end  # Basic
end  # Logging::Layouts

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logging-1.6.1 lib/logging/layouts/basic.rb
logging-1.6.0 lib/logging/layouts/basic.rb
logging-1.5.2 lib/logging/layouts/basic.rb
logging-1.5.1 lib/logging/layouts/basic.rb
logging-1.5.0 lib/logging/layouts/basic.rb