LogFilter.h

Classes

LogFilter -- Filter LogMessages on message priority. (full description)

class LogFilter : public LogFilterInterface

Interface

Public Members
LogFilter (LogMessage::Priority lowest=LogMessage::NORMAL)
LogFilter (const LogFilter& other)
LogFilter& operator= (const LogFilter& other)
virtual ~LogFilter()
virtual LogFilter* clone() const
virtual Bool pass (const LogMessage& message) const
LogMessage::Priority lowestPriority() const

Description

Review Status

Reviewed By:
wbrouw
Date Reviewed:
1996/08/21
Programs:
Demos:
Tests:

Prerequisite

Etymology

Log[Message] Filter.

Synopsis

The LogFilter class is used by the various log sink classes, typically accessed through LogSink, to decide whether a particular LogMessage should be accepted or rejected.

Simple filtering is based on the messages priority. In particular, you typically will choose to only pass messages greater than or equal to NORMAL in priority, but you might choose DEBUGGING to see all messages, or SEVERE to only see messages that report serious problems.

Example

Suppose we wanted to change the global sink so that it prints all messages, including debugging messages:
    LogFilter all(LogMessage::DEBUGGING);
    LogSink::globalSink().filter(all);
    

Motivation

Member Description

LogFilter (LogMessage::Priority lowest=LogMessage::NORMAL)

Construct a filter with the LOWEST priority that you want passed. Thus DEBUGGING passes everything. Note that it is not possible to block SEVERE level messages, although you can use a NullLogSink which will have this effect.

LogFilter (const LogFilter& other)
LogFilter& operator= (const LogFilter& other)

Copy other to this.

virtual ~LogFilter()

virtual LogFilter* clone() const

Clone the object.

virtual Bool pass (const LogMessage& message) const

Return True if message passes this filter.

LogMessage::Priority lowestPriority() const

Return the lowest priority which will pass this filter.