public package Foswiki::Logger

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

  • Foswiki::Logger::Compatibility - Compatibility with old LocalSite.cfg settings, if user has not run configure yet. This logger is automatically used if Foswiki senses that the LocalSite.cfg hasn't been modified for 1.1 (configure has not been run yet). It may also be explicitly selected in configure.
  • Foswiki::Logger::PlainFile - Plain file implementation of the Foswiki Logger interface. Mostly compatible with TWiki (and Foswiki 1.0.0) log files, except that dates are recorded using ISO format, and include the time, and it dies when a log can't be written (rather than printing a warning).

public package Foswiki::Logger

Object that interfaces to whatever records Foswiki log files.

This is a base class which will be subclassed by a class in the Logger subdirectory and selected by $Foswiki::cfg{Log}{Implementation}

Note that the implementation has to provide a way for the log to be replayed. Unfortunately this means that the simpler CPAN loggers are not suitable.

ObjectMethod log($level, @fields)

Adds a log message to a log.

  • $level - level of the event - one of debug, info, warning, error, critical, alert, emergency.
  • @fields - an arbitrary list of fields to output to the log. These fields are recoverable when the log is enumerated using the eachEventSince method.

The levels are chosen to be compatible with Log::Dispatch.

ObjectMethod eachEventSince($time, $level) → $iterator

  • $time - a time in the past
  • $level - log level to return events for.

Get an iterator over the list of all the events at the given level between $time and now.

Events are returned in oldest-first order.

Each event is returned as a reference to an array. The first element of this array is always the date of the event (seconds since the epoch). Subsequent elements are the fields passed to log.

Note that a log implementation may choose to collapse several log levels into a single log. In this case, all messages in the same set as the requested level will be returned if any of the collapsed levels is selected.

This topic: System > WebHome > ReferenceManual > DeveloperDocumentationCategory > PerlDoc
Topic revision: 19 Apr 2011, ProjectContributor
 
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding BACCHUS Wiki? Send feedback