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:
parent
4394940594
commit
fb5c67280f
1 changed files with 5 additions and 1 deletions
|
|
@ -260,7 +260,11 @@ pub fn std_log_function(
|
||||||
const log_pid = std_log_pid orelse return;
|
const log_pid = std_log_pid orelse return;
|
||||||
const prefix = "[" ++ comptime level.asText() ++ "] ";
|
const prefix = "[" ++ comptime level.asText() ++ "] ";
|
||||||
var buf: [max_log_message]u8 = undefined;
|
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) {
|
if (level == .err) {
|
||||||
log_pid.send(.{ "log", "error", @tagName(scope), "std.log", "->", output }) catch {};
|
log_pid.send(.{ "log", "error", @tagName(scope), "std.log", "->", output }) catch {};
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue