File tree 1 file changed +11
-1
lines changed 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,24 @@ pub const LineInfo = struct {
52
52
53
53
var stderr_mutex = std .Mutex .init ();
54
54
55
- /// Deprecated. Use `std.log` functions for logging.
55
+ /// Deprecated. Use `std.log` functions for logging or `std.debug.print` for
56
+ /// "printf debugging".
56
57
pub fn warn (comptime fmt : []const u8 , args : var ) void {
57
58
const held = stderr_mutex .acquire ();
58
59
defer held .release ();
59
60
const stderr = io .getStdErr ().writer ();
60
61
nosuspend stderr .print (fmt , args ) catch return ;
61
62
}
62
63
64
+ /// Print to stderr, unbuffered, and silently returning on failure. Intended
65
+ /// for use in "printf debugging." Use `std.log` functions for proper logging.
66
+ pub fn print (comptime fmt : []const u8 , args : var ) void {
67
+ const held = stderr_mutex .acquire ();
68
+ defer held .release ();
69
+ const stderr = io .getStdErr ().writer ();
70
+ nosuspend stderr .print (fmt , args ) catch return ;
71
+ }
72
+
63
73
pub fn getStderrMutex () * std.Mutex {
64
74
return & stderr_mutex ;
65
75
}
You can’t perform that action at this time.
0 commit comments