|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "common/stdint.h"Go to the source code of this file.
Macros | |
| #define | KLOG_LEVEL KLOG_LEVEL_DEBUG |
| compile-time minimum level. | |
| #define | KLOG_DEBUG(...) |
| #define | KLOG_INFO(...) |
| #define | KLOG_WARN(...) |
| #define | KLOG_ERROR(...) |
Enumerations | |
| enum | klog_level_t { KLOG_LEVEL_DEBUG = 0 , KLOG_LEVEL_INFO , KLOG_LEVEL_WARN , KLOG_LEVEL_ERROR } |
| kernel logging: level-tagged diagnostics written to the serial port. More... | |
Functions | |
| void | klog_init (void) |
| initialize the logging backend (brings up the serial port). | |
| void | klog_device_init (void) |
| register /dev/kmsg: each line a program writes becomes an info line in the log (on the serial port). | |
| void | klog_set_echo (void(*putchar)(char c)) |
| also write every log line with this function (the console during boot), or stop with NULL. | |
| void | klog (klog_level_t level, const char *fmt,...) __attribute__((format(printf |
| write a level-tagged, formatted log line to the serial port. | |
| #define KLOG_LEVEL KLOG_LEVEL_DEBUG |
compile-time minimum level.
messages below this are dropped at compile time. defaults to INFO in release (NDEBUG) and DEBUG otherwise. override by defining KLOG_LEVEL on the compiler command line.
| #define KLOG_DEBUG | ( | ... | ) |
| #define KLOG_INFO | ( | ... | ) |
| #define KLOG_WARN | ( | ... | ) |
| #define KLOG_ERROR | ( | ... | ) |
| enum klog_level_t |
kernel logging: level-tagged diagnostics written to the serial port.
klog output goes to COM1 (see drivers/serial), so it is visible headlessly under QEMU with -serial stdio and works before/without the VGA console.
use the level macros (KLOG_DEBUG/INFO/WARN/ERROR) rather than calling klog() directly. each expands to nothing when its level is below the compile-time KLOG_LEVEL threshold, so verbose logging costs zero in release builds. log severity levels, lowest to highest.
| Enumerator | |
|---|---|
| KLOG_LEVEL_DEBUG | |
| KLOG_LEVEL_INFO | |
| KLOG_LEVEL_WARN | |
| KLOG_LEVEL_ERROR | |
| void klog_init | ( | void | ) |
initialize the logging backend (brings up the serial port).
call once, early in boot, before any KLOG_* macro is used.
| void klog_device_init | ( | void | ) |
register /dev/kmsg: each line a program writes becomes an info line in the log (on the serial port).
call once the device registry is up.
| void klog_set_echo | ( | void(* | putchar )(char c) | ) |
also write every log line with this function (the console during boot), or stop with NULL.
| void klog | ( | klog_level_t | level, |
| const char * | fmt, | ||
| ... ) |
write a level-tagged, formatted log line to the serial port.
appends a trailing newline. prefer the KLOG_* macros over this.
| level | severity of the message. |
| fmt | printf-style format string. |