Skip to content

Commit

Permalink
Stop generating files with logs from host_exerciser (#2773)
Browse files Browse the repository at this point in the history
The afu_test C++ infrastructure, used by host_exerciser, was logging both to the
console and to a separate log file. Leaving files in the working directory every
time host_exerciser is run is messy. Stop generating the files. When a log is needed,
users can pipe output to a file or use tee.
  • Loading branch information
michael-adler committed Nov 14, 2022
1 parent a620bbd commit 30bbaf6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions libraries/afu-test/afu_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ class afu {
app_.require_subcommand();
CLI11_PARSE(app_, argc, argv);

auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();

command::ptr_t test(nullptr);
CLI::App *app = nullptr;
for (auto kv : commands_) {
Expand All @@ -256,11 +254,8 @@ class afu {
return exit_codes::not_run;
}

std::stringstream ss;
ss << name_ << "_" << test->name() << ".log";
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(ss.str(), true);
file_sink->set_level(spdlog::level::trace);
logger_ = std::make_shared<spdlog::logger>(test->name(), spdlog::sinks_init_list ({console_sink, file_sink}));
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
logger_ = std::make_shared<spdlog::logger>(test->name(), console_sink);
spdlog::register_logger(logger_);
logger_->set_level(spdlog::level::from_str(log_level_));

Expand Down

0 comments on commit 30bbaf6

Please sign in to comment.