<util/log.h>¶
Leveled logging.
In the kernel (__ZUZU__ defined) the KTRACE()..KFATAL() macros print to the kernel console and compile away below CONFIG_LOG_LEVEL. In userspace, LOG_DEBUG()..LOG_ERROR() go through LogWrite() with a run-time minimum level.
#include <util/log.h>
Constants¶
Enumerations¶
LogLevel¶
Log severity, lowest first.
| Name | Value | Description |
|---|---|---|
LOG_LEVEL_TRACE |
0 |
Very verbose tracing. |
LOG_LEVEL_DEBUG |
1 |
Debugging detail. |
LOG_LEVEL_INFO |
2 |
Normal operation. |
LOG_LEVEL_WARN |
3 |
Something unexpected but recoverable. |
LOG_LEVEL_ERROR |
4 |
An operation failed. |
LOG_LEVEL_FATAL |
5 |
The program cannot continue. |
Functions¶
LogSetLevel¶
void LogSetLevel(LogLevel min_level);
Sets the lowest level LogWrite() prints.
| Parameter | Direction | Description |
|---|---|---|
min_level |
in | Messages below this level are dropped. |
LogGetLevel¶
LogLevel LogGetLevel(void);
Returns the lowest level LogWrite() prints.
Returns: The current minimum level.
LogWrite¶
void LogWrite(LogLevel level, const char *tag, const char *fmt,...);
Prints one log line to stdout: level, uptime in ms, optional tag, message.
Messages longer than 191 characters are cut.
| Parameter | Direction | Description |
|---|---|---|
level |
in | Severity; dropped if below the minimum level. |
tag |
in | Short source name shown in parentheses, or NULL. |
fmt |
in | printf-style format. |