Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2024-10-20 19:49:36


On Sun, Oct 20, 2024 at 12:15 PM Marcelo Zimbres Silva <mzimbres_at_[hidden]>
wrote:

> > It is also questionable to pollute the public API with log types
>

I don't characterize a template parameter enabling opt-in to a commonly
requested feature as "pollution."

> ...we are too afraid of upsetting users by logging into a global state
>

A global solution increases the run-time costs even when not logging, which
the mqtt5 authors find objectionable. I would in fact prefer a global
solution, because I think that paying for a conditional to evaluate a
pointer for being not-null is negligible compared to the other costs. For
example I would prefer this:

    using log_fn_type = void (*)(std::string_view);
    log_fn_type gLogger = nullptr;

and inside mqtt5 member functions:

    if( gLogger != nullptr )
        (*gLogger)("log text");

We have a log library in Boost so why not default to it?
>

mqtt5 already has enough dependencies (and would benefit from trimming some
of them away). Users who are integrating mqtt5 into their existing code
base might prefer a way to use the logging infrastructure which is already
there.

Thanks


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