aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJonathan Marler <johnnymarler@gmail.com>2021-06-24 04:30:05 -0600
committerJonathan Marler <johnnymarler@gmail.com>2021-06-24 04:30:05 -0600
commitcadf32d74545a31daaddcfccbf0f8e68efea66a7 (patch)
tree775ceb86a8e6cde8b6a9122aad6901e4cbeaab95 /test
parent642f5df0abbcfda47df94ba657b24a913d6903d4 (diff)
downloadzig-cadf32d74545a31daaddcfccbf0f8e68efea66a7.tar.gz
zig-cadf32d74545a31daaddcfccbf0f8e68efea66a7.zip
Expose mechanism to convert log level to text
Diffstat (limited to 'test')
-rw-r--r--test/compare_output.zig22
1 files changed, 2 insertions, 20 deletions
diff --git a/test/compare_output.zig b/test/compare_output.zig
index 742e43e6c7..c3da3cc4a5 100644
--- a/test/compare_output.zig
+++ b/test/compare_output.zig
@@ -585,16 +585,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ comptime format: []const u8,
\\ args: anytype,
\\) void {
- \\ const level_txt = switch (level) {
- \\ .emerg => "emergency",
- \\ .alert => "alert",
- \\ .crit => "critical",
- \\ .err => "error",
- \\ .warn => "warning",
- \\ .notice => "notice",
- \\ .info => "info",
- \\ .debug => "debug",
- \\ };
+ \\ const level_txt = comptime level.asText();
\\ const prefix2 = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
\\ const stdout = std.io.getStdOut().writer();
\\ nosuspend stdout.print(level_txt ++ prefix2 ++ format ++ "\n", args) catch return;
@@ -638,16 +629,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ comptime format: []const u8,
\\ args: anytype,
\\) void {
- \\ const level_txt = switch (level) {
- \\ .emerg => "emergency",
- \\ .alert => "alert",
- \\ .crit => "critical",
- \\ .err => "error",
- \\ .warn => "warning",
- \\ .notice => "notice",
- \\ .info => "info",
- \\ .debug => "debug",
- \\ };
+ \\ const level_txt = comptime level.asText();
\\ const prefix2 = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";
\\ const stdout = std.io.getStdOut().writer();
\\ nosuspend stdout.print(level_txt ++ prefix2 ++ format ++ "\n", args) catch return;