aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-06-02 19:22:22 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-06-17 18:36:44 +0200
commitc3e0224792510e69763dbc6ba68794f9134925f2 (patch)
treec7c320bbd96a04da25af997b01afe4507425a36a /lib
parent8e5393a779ee115846821e28bdb47affdf158992 (diff)
downloadzig-c3e0224792510e69763dbc6ba68794f9134925f2.tar.gz
zig-c3e0224792510e69763dbc6ba68794f9134925f2.zip
Add std.debug.print for "printf debugging"
Diffstat (limited to 'lib')
-rw-r--r--lib/std/debug.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index f3c2cf3b31..92b79be35c 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -52,8 +52,13 @@ pub const LineInfo = struct {
var stderr_mutex = std.Mutex.init();
-/// Deprecated. Use `std.log` functions for logging.
-pub fn warn(comptime fmt: []const u8, args: var) void {
+/// Deprecated. Use `std.log` functions for logging or `std.debug.print` for
+/// "printf debugging".
+pub const warn = print;
+
+/// Print to stderr, unbuffered, and silently returning on failure. Intended
+/// for use in "printf debugging." Use `std.log` functions for proper logging.
+pub fn print(comptime fmt: []const u8, args: var) void {
const held = stderr_mutex.acquire();
defer held.release();
const stderr = io.getStdErr().writer();