boost::logging::filter Namespace Reference

Contains filter implementations. A filter tells the logger if it's enabled or not. More...


Classes

struct  no_ts
 Manages is_enabled/set_enabled in a non-thread-safe way. More...
struct  always_enabled
 Filter that is always enabled. More...
struct  always_disabled
 Filter that is always disabled. More...
struct  debug_enabled
 Filter that is enabled in debug mode. More...
struct  release_enabled
 Filter that is enabled in release mode. More...
struct  ts
 Thread-safe filter. Manages is_enabled/set_enabled in a thread-safe way. More...
struct  use_tss_with_cache
 Uses TSS (Thread Specific Storage) to find out if a filter is enabled or not. More...
struct  use_tss_once_init
 Uses TSS (Thread Specific Storage) to find out if a filter is enabled or not. Once the filter is initialized to a value, that value will always be used. More...


Detailed Description

Contains filter implementations. A filter tells the logger if it's enabled or not.

The filter namespace contains a few implementations of filter classes.

Filter is just a concept. You decide what a filter is.

The minimalistic filter knows only if it's enabled

Filter interface:

    struct some_filter class {
        // is filter enabled
        bool is_enabled() ;

        // ... whatever else you might want
    };

In your logger, you can use any filter class that's already here, or implement your own. Implementing a filter is usually as easy as it gets:

    struct filter_no_ts {
        filter_no_ts() : m_enabled(true) {}

        bool is_enabled() const { return m_enabled; }
        void set_enabled(bool enabled) { m_enabled = enabled; }
    private:
        bool m_enabled;
    };

The filters defined by the library are:



Copyright John Torjo © 2007
Have a question/ suggestion/ comment? Send me feedback