BloombergLP::ball::FilteringObserver

This class provides a concrete implementation of the Observer protocol that filters the Record and Context objects passed to its publish method based on a callback (function or functor) supplied at construction. The callback must be convertible to: ` bsl::function<bool(const Record&, const Context&)> ` If the callback returns true for the Record and Context, then they are forwarded to the publish method of an observer also supplied at construction. If the callback returns false, then the Record and Context are ignored (i.e., they are filtered out by this observer).

Synopsis

Declared in <ball_filteringobserver.h>

class FilteringObserver
    : public Observer

Base Classes

NameDescription
ObserverThis class provides a protocol for receiving and processing log record output.

Type Aliases

NameDescription
RecordFilterCallback RecordFilterCallback is the type of a user-supplied callback functor used to filter the supplied Record and Context objects based on the user-defined criteria provided by the functor.

Member Functions

NameDescription
FilteringObserver [constructor]Create a filtering observer that conditionally passes log records to the specified observer based on the specified recordFilterCallback. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined if observer is 0 or a cycle is created among observers.
~FilteringObserver [destructor] [virtual]Destroy this object.
publish publish overloads
releaseRecords [virtual]Discard any shared reference to a Record object that was supplied to the publish method, and is held by this observer. Note that this operation should be called if resources underlying the previously provided shared-pointers must be released.
operator BloombergLP::bslmf::NestedTraitDeclaration<FilteringObserver, UsesBslmaAllocator> Declare that this type uses a bslma allocator.

Using Declarations

NameDescription
publish Bring Observer::publish overloads into scope.