Skip to content

std.log

leveled format logging to stderr or any io::Writer below-level messages are never formatted; failed writes are dropped, never fatal

pub Level :: enum {
debug,
info,
warn,
error,
}

severity, lowest first

pub Logger :: struct {
w: *Writer,
scope: []const u8,
min: Level,
}

writes min and above to w, one line each: [level] scope: msg

pub enabled :: fn(self: *Self, l: Level) -> bool

would level l be written

pub log :: fn(self: *Self, l: Level, f: Format)
pub debug :: fn(self: *Self, f: Format)
pub info :: fn(self: *Self, f: Format)
pub warn :: fn(self: *Self, f: Format)
pub error :: fn(self: *Self, f: Format)
pub set_level :: fn(self: *Self, l: Level)

write l and above from now on

pub to :: fn(w: *Writer, scope: []const u8, min: Level) -> Logger

logger to w; empty scope for none; writes min and above

pub set_level :: fn(l: Level)

global level: log::debug etc. write l and above from now on

pub level :: fn() -> Level

current global level

pub debug :: fn(f: Format)
pub info :: fn(f: Format)
pub warn :: fn(f: Format)
pub error :: fn(f: Format)