aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/global.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/global.zig b/src/global.zig
index ecda14281..4cf3ccef0 100644
--- a/src/global.zig
+++ b/src/global.zig
@@ -121,6 +121,18 @@ pub const Output = struct {
return print(fmt, args);
}
+ pub const debug = if (isDebug) _debug else _noop;
+
+ fn _noop(comptime fmt: string, args: anytype) void {}
+
+ pub fn _debug(comptime fmt: string, args: anytype) void {
+ if (fmt[fmt.len - 1] != '\n') {
+ return print(fmt ++ "\n", args);
+ }
+
+ return print(fmt, args);
+ }
+
pub fn print(comptime fmt: string, args: anytype) void {
if (isWasm) {
source.stream.seekTo(0) catch return;