qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.
https://qz.io
Other
842 stars 274 forks source link

Cleanup old log format #1199

Closed tresf closed 11 months ago

tresf commented 11 months ago

Perform cleanup of old log file rotations:

In favor of new format introduced in #1160:

... but not without ensuring a replacement adjacent log exists first, to avoid any debugging data loss.

Closes #1196

akberenz commented 11 months ago

I'm not sure this quite preserves logs how you indicated it should? We don't convert any of the old format to the new and the rollover increments the number so .log.5 will be the oldest file, but if .5.log hasn't been rolled into yet with the this code, that oldest file will still be around even though newer, lower numbered old logs will have been removed.

If anything, we should get a count of both the old format and the new format then delete the old format files, highest number first, down to the rollover count.

tresf commented 11 months ago

that oldest file will still be around even though newer, lower numbered old logs will have been removed.

Yes, but it's a self-healing wound, once 5.log is created, log.5 will be deleted the next time it opens, no?

If anything, we should get a count of both the old format and the new format then delete the old format files, highest number first, down to the rollover count.

I don't want to purge good logs unless they're outdated.

tresf commented 11 months ago

Oh, I see what you're saying... It deleted oldest files last instead of first.... Hmm ok, I'll have to rework this then...