|
ArvernOS
|
This is the general kernel logging module. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <inttypes.h>#include <stdio.h>#include <time/timer.h>Data Structures | |
| struct | log_context_t |
Macros | |
| #define | LOGGING_BUFSIZE 4096 |
| Size of the kernel log ring buffer. Must be a power of two. | |
| #define | __LOG_TIMESTAMP_FORMAT "[%3" PRIu64 ".%03" PRIu64 "%03" PRIu64 "] " |
| #define | __LOG_STREAM(time_us, ctx, level, format, ...) |
| Writes one log line to the structured logger. | |
| #define | __LOG(_level, prefix, format, ...) |
| Writes one log line, using the same timestamp for the whole message. | |
Functions | |
| void | logging_stream_output (char c, void *arg) |
| void | logging_buffer_read (char *buf, size_t size, uint64_t offset) |
Variables | |
| bool | kernel_boot_complete |
This is the general kernel logging module.
In release mode, the logging levels available are:
In debug mode, the following additional logging levels are available:
Each kernel module should ideally have its own logging header that depends on this one. The main use case is to have more configurable loggers that can be enabled/disabled depending on the needs.
| #define __LOG_TIMESTAMP_FORMAT "[%3" PRIu64 ".%03" PRIu64 "%03" PRIu64 "] " |
Timestamp prefix ([seconds.microseconds]) for the logger. The seconds are right-aligned on 3 characters and the fractional part is zero-padded to 6 digits.
| void logging_buffer_read | ( | char * | buf, |
| size_t | size, | ||
| uint64_t | offset ) |
Reads from the kernel log ring buffer.
| buf | destination buffer. |
| size | buffer size in bytes. |
| offset | byte offset into the available log data. |
| void logging_stream_output | ( | char | c, |
| void * | arg ) |
This function is used to output logs.
| c | a character to print |
| arg | optional argument, either a log_context_t or NULL. |
|
extern |
Whether the kernel has finished booting. Until then, logs are written to both the serial port and the screen.