Tweak debug logging

1 - Add a log_level build option to control the default log level from
    the build (e.g. -Dlog_level=debug). Defaults to info

2 - Add a new boolean log_unknown_properties build option to enable
    logging unknown properties. Defautls to false.

3 - Remove the log debug for script eval - this can be a huge value
    (i.e. hundreds of KB), which makes the debug log unusable IMO.
This commit is contained in:
Karl Seguin
2025-05-20 11:22:56 +08:00
parent f95defe82f
commit 769d99e7bd
5 changed files with 47 additions and 11 deletions

View File

@@ -25,14 +25,14 @@ const App = @import("app.zig").App;
const Platform = @import("runtime/js.zig").Platform;
const Browser = @import("browser/browser.zig").Browser;
const build_config = @import("build_config");
const parser = @import("browser/netsurf.zig");
const version = @import("build_info").git_commit;
const log = std.log.scoped(.cli);
pub const std_options = std.Options{
// Set the log level to info
.log_level = .info,
.log_level = @enumFromInt(@intFromEnum(build_config.log_level)),
// Define logFn to override the std implementation
.logFn = logFn,
@@ -59,7 +59,7 @@ pub fn main() !void {
return std.process.cleanExit();
},
.version => {
std.debug.print("{s}\n", .{version});
std.debug.print("{s}\n", .{build_config.git_commit});
return std.process.cleanExit();
},
else => {},