RED4ext
RED4ext copied to clipboard
Reimplement log rotation
Only downside of the new timestamped log files is that now some users can have hundreds (or even thousands for some modders/addicts like DBK) of log files clogging up the logs folder.
Could add logic to keep only the last 5-10 logs. Default log rotation with spdlog doesn't work presumably because the log filenames are different
Maybe add an option to either use log rotation (most common use case) or unique filenames (multiple instance use case)? And by default it could use log rotation.
This is something I want to implement, but I don't have much time to do it these days :(
This is something I want to implement [...]
You mean about my proposal or this?
Could add logic to keep only the last 5-10 logs.
You mean about my proposal or this?
I mean about the original proposal.
Regarding your proposal, I would prefer to stick the timestamp option due to the fact that previously we had many users report errors where the game process did not close properly causing rotation issues.
So keep timestamp (multiple instance compatible and prevent errors) while still enabling log rotation? I might look into this, but in this case (due to timestamp) log rotation would be done manually as I believe spdlog don't support this case?
So keep timestamp (multiple instance compatible and prevent errors) while still enabling log rotation?
Yes
I might look into this, but in this case (due to timestamp) log rotation would be done manually as I believe spdlog don't support this case?
Yes, we need a custom sink for the logger which will do the rotation for timestamped files. Basically:
- List all files.
- Check if they start with logger's name.
- Try to remove, if fail no problem we try next time.