mirror of
https://github.com/rdmsr/zag.git
synced 2026-11-01 07:48:20 +00:00
feat(ke): integrate the logger with KConfig
This commit is contained in:
@@ -57,4 +57,9 @@ config NCPUS
|
|||||||
help
|
help
|
||||||
This option sets the maximum number of CPUs the kernel can support.
|
This option sets the maximum number of CPUs the kernel can support.
|
||||||
|
|
||||||
|
config LOG_BUFFER_SHIFT
|
||||||
|
int "Log buffer size shift"
|
||||||
|
default 14
|
||||||
|
help
|
||||||
|
This option sets the size of the kernel log buffer as a power of two. The actual size is calculated as 2 raised to the power of this value (i.e., 2^LOG_BUFFER_SHIFT bytes).
|
||||||
endmenu
|
endmenu
|
||||||
|
|||||||
+5
-1
@@ -4,6 +4,7 @@ const rtl = @import("rtl");
|
|||||||
const pl = b.pl;
|
const pl = b.pl;
|
||||||
const ke = b.ke;
|
const ke = b.ke;
|
||||||
const ki = ke.private;
|
const ki = ke.private;
|
||||||
|
const config = @import("config");
|
||||||
|
|
||||||
const DebugWriter = struct {
|
const DebugWriter = struct {
|
||||||
interface: std.Io.Writer,
|
interface: std.Io.Writer,
|
||||||
@@ -31,7 +32,10 @@ const DebugWriter = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var ringbuffer = ki.log_ring.RingBuffer(14, 5).init();
|
// Messages are on average 2^5 = 32 bytes.
|
||||||
|
const avg_msg_size_bits = 5;
|
||||||
|
|
||||||
|
var ringbuffer = ki.log_ring.RingBuffer(config.CONFIG_LOG_BUFFER_SHIFT, avg_msg_size_bits).init();
|
||||||
|
|
||||||
pub fn log(
|
pub fn log(
|
||||||
comptime level: std.log.Level,
|
comptime level: std.log.Level,
|
||||||
|
|||||||
Reference in New Issue
Block a user