Function defaultLog [src]
The default implementation for the log function. Custom log functions may
forward log messages to this function.
Uses a 64-byte buffer for formatted printing which is flushed before this
function returns.
Prototype
pub fn defaultLog( comptime message_level: Level, comptime scope: @Type(.enum_literal), comptime format: []const u8, args: anytype, ) void
Parameters
message_level: Level
scope: @Type(.enum_literal)
format: []const u8
Source
pub fn defaultLog(
comptime message_level: Level,
comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
const level_txt = comptime message_level.asText();
const prefix2 = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
var buffer: [64]u8 = undefined;
const stderr = std.debug.lockStderrWriter(&buffer);
defer std.debug.unlockStderrWriter();
nosuspend stderr.print(level_txt ++ prefix2 ++ format ++ "\n", args) catch return;
}