-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add customized suffix append to daily file? Like "20210905.mylog" #2091
Comments
You can use |
Thanks,I believe this can solve my title question, but can I further add sinks(say, qtwidget sink) into this "format daily logger")? |
auto dist_sink = std::make_shared<spdlog::sinks::dist_sink_mt>();
dist_sink->add_sink(
std::make_shared<spdlog::sinks::daily_file_format_sink_mt>(
"%Y%m%d.mylog", ...(other args) ));
// Add other sinks.
dist_sink->add_sink( ... );
auto dist_logger = std::make_shared<spdlog::logger>("dist_logger", dist_sink);
spdlog::register_logger(dist_logger); |
Nice!I will try it. |
I have tried, and just auto formatfilesink = std::make_shared<spdlog::sinks::daily_file_format_sink_mt>("Log_%Y-%m-%d.log", 23, 59);
auto logger = std::make_shared<spdlog::logger>("LogName", _sysFileSink);
logger->sinks().push_back(/*some other sink*/); That works just fine. Thank you again, @tt4g. |
The tile describes my demand. Thanks
The text was updated successfully, but these errors were encountered: