feat(util): Add log function for logging in exception handlers
We want this to always be visible, so the log level must be the highest possible. Unfortunately, that's quite the hack around the existing API and how fatal behaves. The log API stopped scaling already a while ago and needs considerable refactoring to consider the various use-cases that emerged since it was first created on alpha versions of bemanitools.
This commit is contained in:
@@ -64,6 +64,15 @@ static void log_builtin_format(
|
||||
}
|
||||
}
|
||||
|
||||
void log_exception_handler(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
log_builtin_format(LOG_LEVEL_FATAL, LOG_MODULE, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void log_assert_body(const char *file, int line, const char *function)
|
||||
{
|
||||
log_impl_fatal("assert", "%s:%d: function `%s'", file, line, function);
|
||||
|
||||
@@ -66,6 +66,7 @@ enum log_level {
|
||||
LOG_LEVEL_MISC = 3,
|
||||
};
|
||||
|
||||
void log_exception_handler(const char *fmt, ...);
|
||||
void log_assert_body(const char *file, int line, const char *function);
|
||||
void log_to_external(
|
||||
log_formatter_t misc,
|
||||
|
||||
Reference in New Issue
Block a user