blob: 661b97fb7b5c9fa49ab8861b6e0046e88bf3bca4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
const std = @import("std");
const Level = std.log.Level;
pub const log_level: Level = .warn;
pub fn log(
comptime level: Level,
comptime format: []const u8,
args: anytype,
) void {
if (@enumToInt(level) > @enumToInt(log_level)) return;
const msg = "[" ++ switch (level) {
.info => "ok",
.err => "err",
else => level.asText(),
} ++ "]\t" ++ format ++ "\n";
const stderr = std.io.getStdErr().writer();
nosuspend stderr.print(msg, args) catch return;
}
|