// Copyright 2022 DistressNetwork° // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. 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; }