MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
LogCustomizableFilter Class Reference

A customizable log filter to match the users needs. More...

#include <error/LogCustomizableFilter.h>

Inheritance diagram for LogCustomizableFilter:
Inheritance graph
[legend]

Classes

class  AndOperator
 Operator class used to combine two custom filters by the & operator. More...
 
class  Class
 Class filter, used to filter log entries with a given class name. More...
 
class  CustomFilter
 Helper class to get the type info of the derived class. More...
 
class  CustomFilterBase
 Abstract base class for custom filters. More...
 
class  Namespace
 Namespace filter, used to filter log entries with a given namespace. More...
 
class  OrOperator
 Operator class used to combine two custom filters by the | operator. More...
 
class  Severity
 Severity filter, used to filter log entries with a given severity level. More...
 
class  Thread
 ThreadID filter, used to filter log entries with a given thread id. More...
 

Public Types

enum  CompareFlags {
  LESS = 0, LESS_EQUAL, EQUAL, GREATER_EQUAL,
  GREATER, NOT
}
 

Public Member Functions

template<typename T >
LogCustomizableFilteroperator<< (const T &f)
 Add filters by chaining them with this operator. More...
 
virtual bool filter (const LogRecord &record)
 Filters a log entry. More...
 

Protected Attributes

std::vector< boost::shared_ptr
< LogCustomizableFilter::CustomFilterBase > > 
mFilter
 

Detailed Description

A customizable log filter to match the users needs.

e.g.

LogCustomizableFilter cf;
cf << "At "
<< LogCustomizableFilter::Severity<LogCustomizableFilter::LESS_EQUAL>(ERROR)
<< LogCustomizableFilter::Class<EQUAL>("MyClass");

will only log messages that have a severity of CRITICAL or ERROR and come from the class MyClass. That way sinks can be configured to log only a special part of the log entries. Custom filters can be combined by & and | operators. An unlikely but possible thing to do would be having registered a file sink for each namespace/class and sort the messages from different namespaces/classes into different files.

More filters can be added by deriving from LogCustomizableFilter::CustomFilter. The new filter can be chained by adding it via the << operator to the LogCustomizableFilter instance.

Member Enumeration Documentation

Enumerator
LESS 
LESS_EQUAL 
EQUAL 
GREATER_EQUAL 
GREATER 
NOT 

Member Function Documentation

LogCustomizableFilter& operator<< ( const T &  f)
inline

Add filters by chaining them with this operator.

Parameters
fThe filter to add
Returns
Reference to this.
virtual bool filter ( const LogRecord record)
inlinevirtual

Filters a log entry.

Parameters
recordThe log entry.
Returns
true if passed, false if filtered out

Implements LogFilterBase.

Member Data Documentation

std::vector<boost::shared_ptr<LogCustomizableFilter::CustomFilterBase> > mFilter
protected

The documentation for this class was generated from the following file: