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

Avoid creating log file if nothing flushed #3328

Open
dentiny opened this issue Jan 25, 2025 · 0 comments
Open

Avoid creating log file if nothing flushed #3328

dentiny opened this issue Jan 25, 2025 · 0 comments

Comments

@dentiny
Copy link

dentiny commented Jan 25, 2025

I'm using rotating logger for error message, one thing I found is, even if there's no error message, spdlog still creates error log file.
Code pointer here:

file_helper_.open(calc_filename(base_filename_, 0));

I'm wondering if we could avoid creating file if nothing written to spdlog, or at least we provide such option for lazy file creation?

Two benefits:

  • Cleaner user experience, it's weird to see an empty log;
  • Performance, we will not have any syscalls if nothing written.

If owners feel fine for the proposal, I'm willing to create PR and implement the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant