Log the invalid format string to help grepping it in the logs.

master
faluco 3 years ago committed by faluco
parent 9571109a69
commit c7ddedcf72

@ -32,6 +32,7 @@ void json_formatter::format(detail::log_entry_metadata&& metadata, fmt::memory_b
fmt::vprintf(buffer, fmt::to_string_view(metadata.fmtstring), args); fmt::vprintf(buffer, fmt::to_string_view(metadata.fmtstring), args);
} catch (...) { } catch (...) {
fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", metadata.fmtstring); fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", metadata.fmtstring);
fmt::format_to(buffer, " -> srsLog error - Invalid format string: \"{}\"", metadata.fmtstring);
#ifdef STOP_ON_WARNING #ifdef STOP_ON_WARNING
std::abort(); std::abort();
#endif #endif
@ -69,6 +70,7 @@ void json_formatter::format_context_begin(const detail::log_entry_metadata& md,
fmt::vprintf(buffer, fmt::to_string_view(md.fmtstring), args); fmt::vprintf(buffer, fmt::to_string_view(md.fmtstring), args);
} catch (...) { } catch (...) {
fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", md.fmtstring); fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", md.fmtstring);
fmt::format_to(buffer, " -> srsLog error - Invalid format string: \"{}\"", md.fmtstring);
#ifdef STOP_ON_WARNING #ifdef STOP_ON_WARNING
std::abort(); std::abort();
#endif #endif

@ -70,6 +70,7 @@ void text_formatter::format(detail::log_entry_metadata&& metadata, fmt::memory_b
fmt::vprintf(buffer, fmt::to_string_view(metadata.fmtstring), args); fmt::vprintf(buffer, fmt::to_string_view(metadata.fmtstring), args);
} catch (...) { } catch (...) {
fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", metadata.fmtstring); fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", metadata.fmtstring);
fmt::format_to(buffer, " -> srsLog error - Invalid format string: \"{}\"", metadata.fmtstring);
#ifdef STOP_ON_WARNING #ifdef STOP_ON_WARNING
std::abort(); std::abort();
#endif #endif
@ -117,6 +118,7 @@ void text_formatter::format_context_end(const detail::log_entry_metadata& md,
fmt::vprintf(buffer, fmt::to_string_view(md.fmtstring), args); fmt::vprintf(buffer, fmt::to_string_view(md.fmtstring), args);
} catch (...) { } catch (...) {
fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", md.fmtstring); fmt::print(stderr, "srsLog error - Invalid format string: \"{}\"\n", md.fmtstring);
fmt::format_to(buffer, " -> srsLog error - Invalid format string: \"{}\"", md.fmtstring);
#ifdef STOP_ON_WARNING #ifdef STOP_ON_WARNING
std::abort(); std::abort();
#endif #endif

Loading…
Cancel
Save