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 @@ -58,14 +58,24 @@ var stderr_file_out_stream: File.OutStream = undefined;
58
58
var stderr_stream : ? * File.OutStream = null ;
59
59
var stderr_mutex = std .Mutex .init ();
60
60
61
- /// Deprecated. Use `std.log` functions for logging.
61
+ /// Deprecated. Use `std.log` functions for logging or `std.debug.print` for
62
+ /// "printf debugging".
62
63
pub fn warn (comptime fmt : []const u8 , args : var ) void {
63
64
const held = stderr_mutex .acquire ();
64
65
defer held .release ();
65
66
const stderr = getStderrStream ();
66
67
nosuspend stderr .print (fmt , args ) catch return ;
67
68
}
68
69
70
+ /// Print to stderr, silently returning on failure. Intended for use in
71
+ /// "printf debugging." Use `std.log` functions for proper logging.
72
+ pub fn print (comptime fmt : []const u8 , args : var ) void {
73
+ const held = stderr_mutex .acquire ();
74
+ defer held .release ();
75
+ const stderr = getStderrStream ();
76
+ nosuspend stderr .print (fmt , args ) catch return ;
77
+ }
78
+
69
79
pub fn getStderrStream () * File.OutStream {
70
80
if (stderr_stream ) | st | {
71
81
return st ;
You can’t perform that action at this time.
0 commit comments