mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 18:11:33 +08:00
Rethrow cppformat exceptions as spdlog_ex with description of the bad format string
This commit is contained in:
parent
b0926326bb
commit
58970bf1ea
@ -71,7 +71,17 @@ inline spdlog::details::line_logger spdlog::logger::log(level::level_enum lvl, c
|
|||||||
bool msg_enabled = should_log(lvl);
|
bool msg_enabled = should_log(lvl);
|
||||||
details::line_logger l(this, lvl, msg_enabled);
|
details::line_logger l(this, lvl, msg_enabled);
|
||||||
if (msg_enabled)
|
if (msg_enabled)
|
||||||
l.write(fmt, args...);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
l.write(fmt, args...);
|
||||||
|
}
|
||||||
|
catch(const fmt::FormatError& e)
|
||||||
|
{
|
||||||
|
throw spdlog_ex(fmt::format("formatting error while processing format string '{}': {}", fmt, e.what()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user