Skip to content
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 @@ -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
Loading