It's possible to create multiple filters with multiple criteria on each filter and then route each filter to a separate target. This permits advanced logging of different types of events to different log targets.
A filter will automatically attempt to publish itself to all targets. You can change this behavior by calling UnpublishToMultiple( AllTargets() ) on that filter, followed by PublishTo() to publish that filter to an output of your choice.
{
Filter filter;
filter.Group(
_LG(
"Audio"));
Cerr err;
WARN(
_LG(
"This message won't happen because it's not in the Graphics group"));
#undef LOGOG_GROUP
#undef LOGOG_CATEGORY
#define LOGOG_GROUP "Graphics"
#define LOGOG_CATEGORY "Unrecoverable"
#undef LOGOG_CATEGORY
#define LOGOG_CATEGORY "Recoverable"
WARN(
_LG(
"The graphics card has been replaced"));
#undef LOGOG_GROUP
#define LOGOG_GROUP "Audio"
WARN(
_LG(
"The headphones are unplugged"));
#undef LOGOG_GROUP
#define LOGOG_GROUP "Inputs"
WARN(
_LG(
"The inputs have been yanked off but this fact won't be reported!"));
#undef LOGOG_CATEGORY
#undef LOGOG_GROUP
#define LOGOG_CATEGORY NULL
#define LOGOG_GROUP NULL
}