refactor: drop level prefix from std.log error and info messages

Errors are already logged as errors and info messages don't need any
extra context.
This commit is contained in:
CJ van den Berg 2025-12-02 13:24:26 +01:00
parent 4394940594
commit fb5c67280f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -260,7 +260,11 @@ pub fn std_log_function(
const log_pid = std_log_pid orelse return;
const prefix = "[" ++ comptime level.asText() ++ "] ";
var buf: [max_log_message]u8 = undefined;
const output = std.fmt.bufPrint(&buf, prefix ++ format, args) catch "MESSAGE TOO LARGE";
const fmt = switch (level) {
.warn, .debug => prefix ++ format,
.err, .info => format,
};
const output = std.fmt.bufPrint(&buf, fmt, args) catch "MESSAGE TOO LARGE";
if (level == .err) {
log_pid.send(.{ "log", "error", @tagName(scope), "std.log", "->", output }) catch {};
} else {