Skip to content

Commit

Permalink
chore: Revert "remove debug_logging flag" (#11498)
Browse files Browse the repository at this point in the history
This reverts commit 3d2a89b and adds
back the debug_logging flag to prevent unnecessary debug() spamming.
  • Loading branch information
lucasxia01 authored Jan 25, 2025
1 parent ab2c860 commit de304d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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 @@ -1316,7 +1316,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
3 changes: 3 additions & 0 deletions barretenberg/cpp/src/barretenberg/common/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ bool verbose_logging = std::getenv("BB_VERBOSE") == nullptr ? false : std::strin
#else
bool verbose_logging = true;
#endif

// Used for `debug` in log.hpp.
bool debug_logging = false;
6 changes: 5 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,14 @@ 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());
// NDEBUG is used to turn off asserts, so we want this flag to prevent debug log spamming.
if (debug_logging) {
logstr(format(args...).c_str());
}
}
#else
template <typename... Args> inline void debug(Args... /*unused*/) {}
Expand Down

1 comment on commit de304d8

@AztecBot
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: de304d8 Previous: ab2c860 Ratio
wasmconstruct_proof_ultrahonk_power_of_2/20 14631.793711 ms/iter 13507.682594000002 ms/iter 1.08

This comment was automatically generated by workflow using github-action-benchmark.

CC: @ludamad @codygunton

Please sign in to comment.