On Sun, Oct 20, 2024 at 12:15 PM Marcelo Zimbres Silva
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