Log: add FormatError() overload with std::exception

This commit is contained in:
Max Kellermann 2016-09-04 14:34:47 +02:00
parent d84f96a571
commit 3887465d80
2 changed files with 16 additions and 0 deletions

View File

@ -119,6 +119,18 @@ LogError(const std::exception &e, const char *msg)
}
}
void
FormatError(const std::exception &e, const char *fmt, ...)
{
char msg[1024];
va_list ap;
va_start(ap, fmt);
vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
LogError(e, msg);
}
void
LogError(const Error &error)
{

View File

@ -89,6 +89,10 @@ LogError(const std::exception &e);
void
LogError(const std::exception &e, const char *msg);
gcc_printf(2,3)
void
FormatError(const std::exception &e, const char *fmt, ...);
gcc_printf(2,3)
void
FormatError(const Domain &domain, const char *fmt, ...);