Skip to content

Commit

Permalink
Merge pull request #836 from tigerbeetledb/dj-build-log-level
Browse files Browse the repository at this point in the history
Build: Add `-Dconfig-log-level` to build options
  • Loading branch information
sentientwaffle committed Jun 5, 2023
2 parents b5fb287 + f0a78fd commit 9580b92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ pub fn build(b: *std.build.Builder) void {
b.option(config.ConfigBase, "config", "Base configuration.") orelse .default,
);

options.addOption(
std.log.Level,
"config_log_level",
b.option(std.log.Level, "config-log-level", "Log level.") orelse .info,
);

const tracer_backend = b.option(
config.TracerBackend,
"tracer-backend",
Expand Down
1 change: 1 addition & 0 deletions src/config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ pub const configs = struct {

// Zig's `addOptions` reuses the type, but redeclares it — identical structurally,
// but a different type from a nominal typing perspective.
base.process.log_level = @intToEnum(std.log.Level, @enumToInt(build_options.config_log_level));
base.process.tracer_backend = @intToEnum(TracerBackend, @enumToInt(build_options.tracer_backend));
base.process.hash_log_mode = @intToEnum(HashLogMode, @enumToInt(build_options.hash_log_mode));
base.process.aof_record = build_options.config_aof_record;
Expand Down
1 change: 1 addition & 0 deletions src/demos/demo.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub const log_level: std.log.Level = .alert;

pub const vsr_options = .{
.config_base = vsr.config.ConfigBase.default,
.config_log_level = std.log.Level.info,
.tracer_backend = vsr.config.TracerBackend.none,
.hash_log_mode = vsr.config.HashLogMode.none,
.config_aof_record = false,
Expand Down

0 comments on commit 9580b92

Please sign in to comment.