add std.debug.Trace.format

This makes it show up in some useful places; for example in the
self-hosted compiler we already print it now with
--debug-compile-errors.
This commit is contained in:
Andrew Kelley 2022-06-12 00:57:59 -07:00
parent 85492f2b91
commit c29746aa55

View File

@ -2023,5 +2023,22 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize
}) catch return;
}
}
pub fn format(
t: Trace,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = fmt;
_ = options;
if (enabled) {
try writer.writeAll("\n");
t.dump();
try writer.writeAll("\n");
} else {
return writer.writeAll("(value tracing disabled)");
}
}
};
}