Commit 88e50b30c3
Changed files (1)
lib
std
lib/std/debug.zig
@@ -219,10 +219,14 @@ pub fn unlockStderrWriter() void {
std.Progress.unlockStderrWriter();
}
-/// Print to stderr, unbuffered, and silently returning on failure. Intended
-/// for use in "printf debugging". Use `std.log` functions for proper logging.
+/// Print to stderr, silently returning on failure. Intended for use in "printf
+/// debugging". Use `std.log` functions for proper logging.
+///
+/// Uses a 64-byte buffer for formatted printing which is flushed before this
+/// function returns.
pub fn print(comptime fmt: []const u8, args: anytype) void {
- const bw = lockStderrWriter(&.{});
+ var buffer: [64]u8 = undefined;
+ const bw = lockStderrWriter(&buffer);
defer unlockStderrWriter();
nosuspend bw.print(fmt, args) catch return;
}