Provide an observer that filters log records.
More...
Namespaces |
namespace | ball |
Detailed Description
- Outline
-
-
- Purpose:
- Provide an observer that filters log records.
-
- Classes:
-
- See also:
- Component ball_record, Component ball_context, Component ball_loggermanager
-
- Description:
- This component provides a concrete implementation of the
ball::Observer
protocol for receiving and processing log records: ,-----------------------.
( ball::FilteringObserver )
`-----------------------'
| ctor
V
,--------------.
( ball::Observer )
`--------------'
publish
dtor
ball::FilteringObserver
processes the log records it receives through its publish
method and conditionally forwards them to the inner observer supplied at construction.
-
- Usage:
- This section illustrates intended use of this component.
-
- Example 1: Basic Usage:
- This example shows how to use filtering observer to route some log records to a designated observer. A common use case is routing all log records for a given category (or category pattern) to a separate log file.
- First, we create a filter that will match a log record's category against the pattern "EQUITY.*": Then, we create the observer that will receive filtered log records and create a filtering observer: Next, we issue a series of log records and verify that only records with the category matching the pattern are published to the inner observer: