How to allow std.log output in test

  • code
const std = @import("std");
const info = std.info;

const std_options = .{
  .level = .info
};

test "log" {
  log.info("log a message", .{});
}
  • result

no log message output

You need to set std.testing.log_level.

    std.testing.log_level = std.log.Level.info;

Note that log.err during testing is considered a test case failure.

5 Likes