[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user