aboutsummaryrefslogtreecommitdiff
path: root/include/logging.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-03-22 10:08:54 +0000
committerGravatar Sadie Powell2025-03-28 10:23:22 +0000
commitb51264cc211bb6e6d1598fd0a2344a56bd3df11f (patch)
tree903c4f6af408f6294436636b4d14f7243a393cab /include/logging.h
parentThere is no need to restore the connect class of a quitting oper. (diff)
Handle errors from {fmt} in Log::Manager::Write.
Diffstat (limited to 'include/logging.h')
-rw-r--r--include/logging.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/logging.h b/include/logging.h
index 01f9104bd..786ba19fe 100644
--- a/include/logging.h
+++ b/include/logging.h
@@ -261,7 +261,15 @@ private:
if (maxlevel < level && !caching)
return; // No loggers care about this message.
- Write(level, type, fmt::vformat(format, fmt::make_format_args(args...)));
+ try
+ {
+ Write(level, type, fmt::vformat(format, fmt::make_format_args(args...)));
+ }
+ catch (const fmt::format_error& err)
+ {
+ // This should only ever happen when we encounter a bug.
+ Write(Log::Level::CRITICAL, "LOG", "BUG: failed to format a log message: {} -- {}", format, err.what());
+ }
}
public: