[libj6] Add log area and severity to j6::syslog()

User code can now set the log area and severity of log messages. This also updates the j6_log
syscall to take these parameters, but removes all calls to it except through j6::syslog().
This commit is contained in:
Justin C. Miller
2024-02-24 13:39:24 -08:00
parent a1e2c58afc
commit bc46c9a7d5
22 changed files with 114 additions and 77 deletions

View File

@@ -124,7 +124,8 @@ LOG_LEVEL_FUNCTION(info);
LOG_LEVEL_FUNCTION(warn);
LOG_LEVEL_FUNCTION(error);
void fatal(logs area, const char *fmt, ...)
void
fatal(logs area, const char *fmt, ...)
{
logger *l = logger::s_log;
if (!l) return;
@@ -137,4 +138,19 @@ void fatal(logs area, const char *fmt, ...)
kassert(false, "log::fatal");
}
void
log(logs area, level severity, const char *fmt, ...)
{
logger *l = logger::s_log;
if (!l) return;
level limit = l->get_level(area);
if (severity > limit) return;
va_list args;
va_start(args, fmt);
l->output(severity, area, fmt, args);
va_end(args);
}
} // namespace log