Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(bb): hide debug() logs under --debug flag #7008

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,8 @@ int main(int argc, char* argv[])
{
try {
std::vector<std::string> args(argv + 1, argv + argc);
verbose_logging = flag_present(args, "-v") || flag_present(args, "--verbose_logging");
debug_logging = flag_present(args, "-d") || flag_present(args, "--debug_logging");
verbose_logging = debug_logging || flag_present(args, "-v") || flag_present(args, "--verbose_logging");
if (args.empty()) {
std::cerr << "No command provided.\n";
return 1;
Expand Down
5 changes: 4 additions & 1 deletion barretenberg/cpp/src/barretenberg/common/log.cpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Used for `vinfo` in log.hpp.
bool verbose_logging = false;
bool verbose_logging = false;

// Used for `debug` in log.hpp.
bool debug_logging = false;
5 changes: 4 additions & 1 deletion barretenberg/cpp/src/barretenberg/common/log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ template <typename... Args> std::string benchmark_format(Args... args)
return os.str();
}

extern bool debug_logging;
#ifndef NDEBUG
template <typename... Args> inline void debug(Args... args)
{
logstr(format(args...).c_str());
if (debug_logging) {
logstr(format(args...).c_str());
}
}
#else
template <typename... Args> inline void debug(Args... /*unused*/) {}
Expand Down
Loading