public package
Foswiki::Logger
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.