Skip to content

Conversation

@krichprollsch
Copy link
Member

use --verbose to enable debug output.
In debug mode, verbose is forced to true.

}
}

var verbose: bool = builtin.mode == .Debug; // In debug mode, force verbose.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of this global variable but I guess it's not possible to do without, at least if we want to keep using the std lib log function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think have a global var in the main.zig is not perfect, but ok.

) void {
if (!verbose) {
// hide all messages with level greater of equal to debug level.
if (@intFromEnum(level) >= @intFromEnum(std.log.Level.debug)) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As debug is the last level I think checking an equality should be more clear. But of course like that you can't handle addition lowers levels. So it's also good to me like.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But Since we filter here, I do prefer the >= to avoid more verbose messages if a lower level is added by Zig later.

@krichprollsch krichprollsch merged commit ebe2c8e into main Dec 17, 2024
8 checks passed
@krichprollsch krichprollsch deleted the verbose-option branch December 17, 2024 08:42
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants