one-shot logger updates

On one-shot second and further calls of one-shot message, no output was
producet, yet empty buffer was submitted to Log_output resulting in
false repeate messages:

    Last message repeated <n> times

To simplify the stuff, C++ API was removed and in the C API the Logger
is taken only if actual message will be output. If someone is willing to
use the C++ API, it can be later readded (not really needed now, only
simple message are presented).
This commit is contained in:
Martin Pulec
2023-01-10 16:17:33 +01:00
parent bdf389099c
commit e3574d3d66
4 changed files with 7 additions and 14 deletions

View File

@@ -141,10 +141,11 @@ void log_msg(int level, const char *format, ...) {
}
void log_msg_once(int level, uint32_t id, const char *msg) {
if (log_level < level) {
if (Logger::oneshot_messages.count(id) > 0 || log_level < level) {
return;
}
Logger(level).once(id, msg);
Logger::oneshot_messages.insert(id);
Logger(level).Get() << msg;
}
/**