1

At the moment I am combining a file sink with a console sink. (see bellow)

std::vector<spdlog::sink_ptr> sinks;
                    sinks.push_back(std::make_shared<spdlog::sinks::wincolor_stdout_sink_st>());
                    sinks.push_back(std::make_shared<spdlog::sinks::daily_file_sink_st>(path, 23, 59));
                    std::shared_ptr<class spdlog::logger> logger = std::make_shared<spdlog::logger>(name, begin(sinks), end(sinks));

I still want to log everything to the console, but only write to the file if there is an error. this is because at the moment there are a lot of useless logs and files.

lukan
  • 31
  • 6

1 Answers1

1

You can call file_sink->set_level(spdlog::level::error) to make it log only on error and more severe levels.

Sprite
  • 3,222
  • 1
  • 12
  • 29