Just-Some-Bots / MusicBot

:musical_note: The original MusicBot for Discord (formerly SexualRhinoceros/MusicBot)
https://just-some-bots.github.io/MusicBot/
MIT License
3.09k stars 2.35k forks source link

[Minor Feature Request] have logs files with date and time based filename and clean up routine #2393

Closed OzzyHelix closed 4 months ago

OzzyHelix commented 4 months ago

What new feature would you like to see?

This is a simply request. I would like it if the logs filenames contained the date and time of their creation and then maybe have a routine that every time the bot is started up. It deletes logs older than say 7 days for example. Overwriting the existing log file has been a pet peeve of mine for a while. Having log files with date and time based filenames and a routine to clean older logs up would fix a lot of my problems with the logging system. I hope you will consider this and maybe make it a feature thank you

Which of these categories fit your request?

Other

Just checking...

OzzyHelix commented 4 months ago

my goal with this is to improve small Quality of life stuff with the bot this has been an annoyance for me for some time

itsTheFae commented 4 months ago

So Python logging does have a file handler that theoretically will do what you want, essentially making the log system handle rotation of the log files as-needed, but only triggered by logs being emitted in the first place rather than the current implementation in dev which only bothers to rotate files at shutdown, when logging is finished.

OzzyHelix commented 4 months ago

I will retract this because python run.py --logs-kept 100 suites my needs perfectly

itsTheFae commented 4 months ago

I will retract this because python run.py --logs-kept 100 suites my needs perfectly

And for setting the date format using --log-rotate-fmt you can use the table on this page to understand the '%' formats that are available for use: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior