sql-zig

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

log.zig (706B)


      1 const std = @import("std");
      2 const builtin = @import("builtin");
      3 /// Workaround for failing tests when errors are logged
      4 /// https://github.com/ziglang/zig/issues/5738#issuecomment-1466902082
      5 pub fn scoped_log_t(comptime scope: @Type(.EnumLiteral)) type {
      6     return if (builtin.is_test)
      7         // Downgrade `err` to `warn` for tests.
      8         // Zig fails any test that does `log.err`, but we want to test those code paths here.
      9         struct {
     10             pub const base = std.log.scoped(scope);
     11             pub const err = warn;
     12             pub const warn = base.warn;
     13             pub const info = base.info;
     14             pub const debug = base.debug;
     15         }
     16     else
     17         std.log.scoped(scope);
     18 }