river: fix logging to non-pipe
Since the Zig 0.15 upgrade, if stderr is redirected to a file, river writes every log message to the beginning of the file, overwriting the previous message. This commit fixes that and also switches to the nicer new std.debug API for stderr logging.
This commit is contained in:
@ -188,8 +188,11 @@ pub fn logFn(
|
||||
|
||||
const scope_prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
|
||||
|
||||
var stderr = fs.File.stderr().writer(&.{});
|
||||
stderr.interface.print(level.asText() ++ scope_prefix ++ format ++ "\n", args) catch {};
|
||||
var buffer: [256]u8 = undefined;
|
||||
const stderr = std.debug.lockStderrWriter(&buffer);
|
||||
defer std.debug.unlockStderrWriter();
|
||||
|
||||
stderr.print(level.asText() ++ scope_prefix ++ format ++ "\n", args) catch {};
|
||||
}
|
||||
|
||||
/// See wlroots_log_wrapper.c
|
||||
|
||||
Reference in New Issue
Block a user