Sha256: 998487825db448dcadca9fe1e47bcab06aa92485d1dbbc6d17b665ba73b97c43

Contents?: true

Size: 1.4 KB

Versions: 37

Compression:

Stored size: 1.4 KB

Contents

# :stopdoc:
#
# The formatting of log messages is controlled by the layout given to the
# appender. By default all appenders use the Basic layout. It's pretty
# basic. However, a more sophisticated Pattern layout can be used or one of
# the Parseable layouts -- JSON or YAML.
#
# The available layouts are:
#
#   Logging.layouts.basic
#   Logging.layouts.pattern
#   Logging.layouts.json
#   Logging.layouts.yaml
#
# In this example we'll demonstrate use of different layouts and setting log
# levels in the appenders to filter out events.
#

  require 'logging'

  # only show "info" or higher messages on STDOUT using the Basic layout
  Logging.appenders.stdout(:level => :info)

  # send all log events to the development log (including debug) as JSON
  Logging.appenders.rolling_file(
    'development.log',
    :age    => 'daily',
    :layout => Logging.layouts.json
  )

  # send growl notifications for errors and fatals using a nice pattern
  Logging.appenders.growl(
    'growl',
    :level  => :error,
    :layout => Logging.layouts.pattern(:pattern => '[%d] %-5l: %m\n')
  )

  log = Logging.logger['Foo::Bar']
  log.add_appenders 'stdout', 'development.log', 'growl'
  log.level = :debug

  log.debug "a very nice little debug message"
  log.info "things are operating nominally"
  log.warn "this is your last warning"
  log.error StandardError.new("something went horribly wrong")
  log.fatal "I Die!"

# :startdoc:

Version data entries

37 entries across 37 versions & 8 rubygems

Version Path
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/logging-1.8.2/examples/layouts.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/logging-1.8.2/examples/layouts.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/logging-1.8.2/examples/layouts.rb
TwP-logging-1.1.3 examples/layouts.rb
TwP-logging-1.1.4 examples/layouts.rb
TwP-logging-1.2.0 examples/layouts.rb
TwP-logging-1.2.2 examples/layouts.rb
pjstadig-logging-1.1.4.1 examples/layouts.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/logging-1.8.1/examples/layouts.rb
logging-1.8.2 examples/layouts.rb
logging-1.8.1 examples/layouts.rb
logging-1.8.0 examples/layouts.rb
logging-1.7.2 examples/layouts.rb
logging-1.7.1 examples/layouts.rb
logging-1.7.0 examples/layouts.rb
logging-1.6.2 examples/layouts.rb
logging-1.6.1 examples/layouts.rb
logging-1.6.0 examples/layouts.rb
logging-1.5.2 examples/layouts.rb
logging-1.5.1 examples/layouts.rb