commit d1f99eabb745a3026b4bf0486ee542d38facee8b (tree)
parent c6844072ce440f581787bf97909261084a9edc6c
Author: Luna <git@l4.pm>
Date: Mon, 21 Jun 2021 23:32:06 -0300
add compile error if root.log is not a function
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/std/log.zig b/lib/std/log.zig
@@ -142,6 +142,8 @@ fn log(
if (@enumToInt(message_level) <= @enumToInt(effective_log_level)) {
if (@hasDecl(root, "log")) {
+ if (@typeInfo(@TypeOf(root.log)) != .Fn)
+ @compileError("Expected root.log to be a function");
root.log(message_level, scope, format, args);
} else if (std.Target.current.os.tag == .freestanding) {
// On freestanding one must provide a log function; we do not have