Closed andrea-iob closed 2 years ago
I moved insertion/extraction operators from the operators module to the common module, because those operations need to be defined before the logger. If the operators are defined after the logger, they will not be found by the compiler when selecting the right specialization to be used for the insertion operator in Logger::println (gcc will still accept the code, but this is a gcc bug, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51577).
All fixed, thanks. I've also rebased the branch on top of the current master.
Could it be useful for users to rely on an "enable" method for the logger? I understand the semantic, but double negation to enable (or re-enable) the logger (at its level( it seems not intuitive to me. Maybe a kind of "enableDefault", even if I do not like "Default".
Hello guys, modifications are fine for me, but honestly I've not completely understood the request from Marco, and i don't want to rush my final approval. I will let you to iterate and elaborate more the concept, first.
Could it be useful for users to rely on an "enable" method for the logger? I understand the semantic, but double negation to enable (or re-enable) the logger (at its level( it seems not intuitive to me. Maybe a kind of "enableDefault", even if I do not like "Default".
The function disable(log:Level level)
will provide an overriding verbosity level which takes precedence over the logger’s own level. Its effect is to disable all logging calls of severity level and below. When no arguments are specified, the overriding verbosity will be set to CRITICAL, hence all logger output will be disabled.
Its main purpose is to temporary throttle logging output down. When the logger verbosity can be set again to its defualt value, the function debug
is called with the argument log::NOTSET
and the verbosity override is removed.
(I've updated the wording of the example in the pull request description to better reflect what the function disable
does.)
Fine. Doc in sources was clear and your final comment too. Thanks for re-wording. I approve.
The improvements are:
log::cout
now accepts an argument that specifies the default severity level of the messages;void Logger::disable(log::Level level = log::CRITICAL)
);setVerbosity
renamed tosetDefaultVerbosity
,setPriority
renamed tosetDefaultSevierity
), old functions are still there but they are marked as deprecated.Here some examples: