Skip to content

Commit

Permalink
Merge pull request #996 from lplewa/log-fixes
Browse files Browse the repository at this point in the history
"add missing new lines in logger error messages"  and "Fix infinite loop in logger."
  • Loading branch information
pbalcer authored Oct 30, 2023
2 parents 63aaf07 + 4e56410 commit 42cb4d3
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions source/common/logger/ur_sinks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ class Sink {
if (*(++fmt) == '{') {
buffer << *fmt++;
} else {
std::cerr
<< error_prefix
<< "No arguments provided and braces not escaped!";
std::cerr << error_prefix
<< "No arguments provided and braces not escaped!"
<< std::endl;
}
} else if (*fmt == '}') {
if (*(++fmt) == '}') {
buffer << *fmt++;
} else {
std::cerr << error_prefix
<< "Closing curly brace not escaped!";
<< "Closing curly brace not escaped!"
<< std::endl;
}
}
}
Expand All @@ -97,7 +98,7 @@ class Sink {
buffer << *fmt++;
} else if (*fmt != '}') {
std::cerr << error_prefix
<< "Only empty braces are allowed!";
<< "Only empty braces are allowed!" << std::endl;
} else {
buffer << arg;
arg_printed = true;
Expand All @@ -107,9 +108,17 @@ class Sink {
buffer << *fmt++;
} else {
std::cerr << error_prefix
<< "Closing curly brace not escaped!";
<< "Closing curly brace not escaped!"
<< std::endl;
}
}

if (*fmt == '\0') {
std::cerr << error_prefix << "Too many arguments!" << std::endl;
// ignore all left arguments and finalize message
format(buffer, fmt);
return;
}
}

format(buffer, ++fmt, std::forward<Args &&>(args)...);
Expand Down

0 comments on commit 42cb4d3

Please sign in to comment.