Open
Description
Here's my config code:
inline void setupLogging() {
if(std::filesystem::exists("Log")){
std::filesystem::create_directory("Log");
}
auto file_sink = std::make_shared<spdlog::sinks::daily_file_sink_mt>("Log/daily.log", 0, 0);
file_sink->set_level(spdlog::level::debug);
file_sink->set_pattern("[%Y-%m-%d %H:%M:%S] [thread %t] [%oms] [%l] %v");
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
console_sink->set_level(spdlog::level::debug);
console_sink->set_pattern("%^[%Y-%m-%d %H:%M:%S] [thread %t] [%oms] [%l] %v%$");
auto logger = std::make_shared<spdlog::logger>("multi_sink", spdlog::sinks_init_list{ file_sink, console_sink });
spdlog::register_logger(logger);
spdlog::set_default_logger(logger);
spdlog::flush_on(spdlog::level::debug);
}
It works fine, new files are created based on the date, but the problem is I can't set the file name I want.
For example, this code creates a file like daily_2025-03-05.log
.
And I only want the date, not the 'daily_' in front of it, I don't know how to get rid of it. Can you help me? Thank you very much.
Metadata
Metadata
Assignees
Labels
No labels