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

how to create daily log with rotating feature and log file size is more than 1GB? #2702

Closed
danielabutbul01 opened this issue Apr 10, 2023 · 1 comment

Comments

@danielabutbul01
Copy link

hey,
I am using spdlog::daily_logger_mt() but I want to limit the logger to 1GB size. is that possible?

@tt4g
Copy link
Contributor

tt4g commented Apr 10, 2023

Maybe duplicate #1393

What do you mean by daily and file size rotation?

Each rotation should be considered to be the next operation.

  • Daily rotation is often used to mean changing the log file when the date changes.
  • File size rotation would be rotation when the file size exceeds the limit.

Are you thinking of combining the two? But there is a contradiction in that behavior.
The behavior of not rotating if not over 1 GB even after the date has changed is inconsistent with the name daily rotation.
If the rotation ignores the file size when the date changes, that would be inconsistent with the name file size rotation.

If you really want to realize a rotation that works the way you want it to, create a custom sink.
Please refer to the Wiki (https://github.com/gabime/spdlog/wiki/4.-Sinks#implementing-your-own-sink) for information on how to create a custom sink.

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

2 participants