#include <logger_level.hpp>
Public Member Functions | |
LoggerLevel () | |
Default constructor produces a mask that accepts nothing. | |
LoggerLevel (unsigned l, unsigned s) | |
Construct from level and source bitmasks. | |
const LoggerLevel | operator| (LoggerLevel const &rhs) const |
Bitwise OR operator. | |
const LoggerLevel | operator & (LoggerLevel const &rhs) const |
Bitwise AND operator. | |
operator bool () const | |
Implicit conversion to boolean. |
For now, you can specify message "level" (e.g. Warning versus Debug messages) flags and message "source" (where a message originates) flags. These flag sets occupy exclusive portions of the bit-field, so they are combined using the bitwise-and operator (&). Flags from the same set can be combined using the bitwise-or operator (|). For example, here is one correct (if verbose) way to specify a mask for all messages from the container framework:
LoggerLevel l = CONTAINERS & ALL_LEVELS;
or, if you wanted to capture warning or error messages from everything:
LoggerLevel l = (ERROR | WARNING) & ALL_SOURCES;
Of course, in these cases, it would be sufficient to omit the ALL_LEVELS and ALL_SOURCES flags, because these are implicit -- all of the message level flags imply an acceptance of all sources, and vice-versa. A more complicated example might look like this:
LoggerLevel l = (ERROR | WARNING) & (ATOMS | CONTAINERS);
which would accept all error and warning messages from the atom and container frameworks.
LoggerLevel | ( | ) |
Default constructor produces a mask that accepts nothing.
LoggerLevel | ( | unsigned | l, | |
unsigned | s | |||
) |
Construct from level and source bitmasks.
const LoggerLevel operator| | ( | LoggerLevel const & | rhs | ) | const |
Bitwise OR operator.
const LoggerLevel operator & | ( | LoggerLevel const & | rhs | ) | const |
Bitwise AND operator.
operator bool | ( | ) | const |
Implicit conversion to boolean.