mod(options): build options to log to stderr and/or a file
NOTE: file logging will not work correctly yet due to opening files appending using the std is currently not implemented (as of zig version 0.13.0)!
This commit is contained in:
@@ -6,9 +6,13 @@ const std = @import("std");
|
||||
pub fn build(b: *std.Build) void {
|
||||
// build options to customize the log message formating
|
||||
const include_timestamp = b.option(bool, "timestamp", "Enable inclusion of timestamps in log messages (default: true)") orelse true;
|
||||
const stderr = b.option(bool, "stderr", "Print all log messages to stderr (default: true)") orelse true;
|
||||
const file = b.option([]const u8, "file", "Print all log messages to the provided file.") orelse "";
|
||||
|
||||
const options = b.addOptions();
|
||||
options.addOption(bool, "timestamp", include_timestamp);
|
||||
options.addOption(bool, "stderr", stderr);
|
||||
options.addOption([]const u8, "file", file);
|
||||
|
||||
const options_module = options.createModule();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user