Closed brunoramoslu closed 2 years ago
I added the date to the log file timestamps in 2a78dd89.
But this issue reminded me of another pet peeve of mine: the log file is overwritten when a new client instance is started. Which can be inconvenient when testing multiple clients. OTOH we don't want to keep ages old log files around either. Perhaps I should open a separate issue for this though.
I'd assumed @brunoramoslu was referring to the chat logs not the file in the logs directory. Anyway, I agree that one log getting overwritten by another instance is a pain. Perhaps we could use separate log files per instance and age them off.
I'd assumed @brunoramoslu was referring to the chat logs not the file in the logs directory.
Oh, yeah, you're probably right. Added it there as well.
Anyway, I agree that one log getting overwritten by another instance is a pain. Perhaps we could use separate log files per instance and age them off.
Separating the files in the logs dir also per profile (main/ test/ etc.) would be easy to do and already help somewhat. Also I wonder if we could work around the one file per thread that is used right now.
Message from player in game: "Add date to timestamp in chat log files is a very useful idea but it only takes effect when timestamps are not displayed in the game window"
D'oh :facepalm:
Sorry, should be fixed now. I can't believe I missed that, it was more or less spelled out in the code comments. You know, I thought this would be a a very simple change, not something that would require at least three commits to get right.
Sorry.... Turns out the "%F" formatting for strftime() does not work on windows. When replaced it with "%Y-%m-%d" it does work.
Edit: I'm trying to do some builds so I'll commit this change for now. Please offer an alternative as you wish. I did quickly look at the standard versions we are using but moving to a newer standard did not fix the problem, plus we ought to do a bit more testing if we do that.
%F is C99, but if it doesn't work Y-m-d is fine.
Should be fixed, closing
Currently we only log the time without the date, which makes it difficult to search for things in a big log file. It would be nice to have the date also in the log. No need to change the console/chat messages (those can keep the time only). Date should be in ISO-8601 format: YYYY-MM-DD (e.g.: 2021-12-21)
Edit: add reference to date format