formatter.rb
Path: /home/cepheus/projects/prep/log4r-1.0.1/src/log4r/formatter/formatter.rb
Created: Mon Jan 28 21:59:41 PST 2002
Modified: Mon Jan 28 08:05:05 PST 2002

Formatters

Formatters are responsible for formatting LogEvent data. An Outputter owning a Formatter will invoke the Log4r::Formatter#format method prior to writing.

Available Formatters

XML Configuration

Specify the Formatter and its class (as type) under an <outputter> directive:

  <outputter name="someout" type="sometype">
    <formatter type="Log4r::BasicFormatter"/>
  </outputter>

As explained in log4r/configurator.rb, the hash arguments you would normally pass to new are specified as XML parameters. Only PatternFormatter has any of these.

Custom Formatting

Building a custom Formatter is extremely easy. Just define a class that extends Formatter and override the Formatter#format method. Then give it to any interested Outputters.

If you're interested in setting up your custom formatters in XML, please take a look at log4r/configurator.rb.

Data Available

See Log4r::LogEvent

Version:$Id: formatter.rb,v 1.3 2002/01/28 16:05:05 cepheus Exp $

Required files
"singleton"    "log4r/base"   
Classes and Modules
Module Log4r
  ::Class Log4r::LogEvent
  ::Class Log4r::Outputter
  ::Class Log4r::DefaultFormatter
  ::Class Log4r::RemoteOutputter
  ::Class Log4r::Logger
  ::Class Log4r::Configurator
  ::Class Log4r::RootLogger
  ::Class Log4r::ObjectFormatter
  ::Class Log4r::StderrOutputter
  ::Class Log4r::EmailOutputter
  ::Class Log4r::Formatter
  ::Class Log4r::StdoutOutputter
  ::Class Log4r::ConfigError
  ::Class Log4r::BasicFormatter
  ::Class Log4r::SimpleFormatter
  ::Class Log4r::PatternFormatter
  ::Class Log4r::LogServer
  ::Class Log4r::FileOutputter
  ::Class Log4r::IOOutputter
  ::Class Log4r::Log4rTools