Boost logo

Boost :

Subject: Re: [boost] [log] v2 Initialisation, default sink behaviour and filtering documentation
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-01-23 22:30:28


On January 23, 2013 6:38:45 PM Mats Taraldsvik
<mats.taraldsvik_at_[hidden]> wrote:
> Hi,
>
> I am in the process of moving beyond the default sink now, and had some
> issues. I tried to add the sinks after my logger object had been
> default initialized, and this caused some problems (partial
> streams/corruption, mostly). Currently I'm calling
> core->remove_all_sinks() to remove the default sink. Are there any
> "best practices" here? Perhaps it would be a good idea to add these
> "requirements" to the documentation, if they are not there already and
> I missed them? :)

The default sink cannot be removed, not even with remove_all_sinks. It
is used implicitly when no other sinks are added to the core. When you
add your sink to the core you automatically suppress the use of the
default sink.

As for your problem, could you describe it in more details? A minimal
code sample would be useful.

> --
>
> I also noticed that the severity filter examples are :
>
> logging::core::get()->set_filter
> (
> logging::trivial::severity >= logging::trivial::info
> );
>
> From "Setting up sinks", and
>
> sink->set_filter(expr::attr< int >("Severity") >= 2);
>
> (i.e. comparing the Severity with an int) when moving to the more
> advanced section in "Sink frontends".
>
> Could you adjust one of the examples in "Sink frontends" to use the
> severity_level type (that the documentation introduces in the tutorial
> "Adding more information to log: Attributes") directly? For example:
>
> sink->set_filter(expr::attr< severity_level >("Severity") >= warning);
>
> Or explaining this in "Log record formatting".
>
> I had trouble understanding this at first, but I might be the only one
> :). Thought I'd mention it anyway.

The type of severity level is not mandated by the library, and each
section of the documentation is intended to have minimal dependencies
on other parts of the library. That's why trivial severity levels are
not used in sinks description. I'll think about how to clear this
confusion better.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk