Sha256: 1f8505d6b5ea1577456e2397b3a11e1e26c7ad1b8d6f24ef1fe8881b1de00d18

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

module Logsly::Logging182::Layouts

  # Accessor / Factory for the Basic layout.
  #
  def self.basic( *args )
    return ::Logsly::Logging182::Layouts::Basic if args.empty?
    ::Logsly::Logging182::Layouts::Basic.new(*args)
  end

  # 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 < ::Logsly::Logging182::Layout

    # call-seq:
    #    format( event )
    #
    # Returns a string representation of the given logging _event_. See the
    # class documentation for details about the formatting used.
    #
    def format( event )
      obj = format_obj(event.data)
      sprintf("%*s  %s : %s\n", ::Logsly::Logging182::MAX_LEVEL_LENGTH,
              ::Logsly::Logging182::LNAMES[event.level], event.logger, obj)
    end

  end  # Basic
end  # Logsly::Logging182::Layouts

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logsly-1.3.3 lib/logsly/logging182/layouts/basic.rb
logsly-1.3.2 lib/logsly/logging182/layouts/basic.rb
logsly-1.3.1 lib/logsly/logging182/layouts/basic.rb
logsly-1.3.0 lib/logsly/logging182/layouts/basic.rb