-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add support for splitting log files #11
Conversation
By default, FileLogger will now create new log files when they are more than 1MB. This can be customized with the 'fileSizeCap'- property. Also, you can set 'shouldKeepArchivedLogs' to 'false' to just delete old logs when reaching a certain size. This has the drawback of losing all current logs and starting fresh when reaching the cap, instead of just deleting entries in the beginning of the file.
Result of Integration 1Duration: 22 seconds |
self.logger.log(message) | ||
sizeCounter = sizeCounter + messageSize | ||
} else { | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Habits die hard :) (semicolon)
Great stuff, thanks so much @accatyyc! I also like the defaults, 1MB log and not preserving archives is reasonable. In Buildasaur, we'll probably up the limit a bit. Yeah, being able to specify the number of last log files to keep would be nice, but I consider that a nice enhancement in the future, not in scope for this PR. If you just remove those two semicolons that I market, I'll merge it right away! Thanks again 👏 |
Semicolons gone! (I almost never write Swift so they are engraved into my soul 😄) Something to note - the default for |
Result of Integration 2Duration: 14 seconds |
Awesome, great work! 👍 |
Add support for splitting log files
By default, FileLogger will now create new log files when they
are more than 1MB. This can be customized with the 'fileSizeCap'-
property.
Also, you can set 'shouldKeepArchivedLogs' to 'false' to just
delete old logs when reaching a certain size. This has the drawback
of losing all current logs and starting fresh when reaching the cap,
instead of just deleting entries in the beginning of the file.
A good addition to this PR would be keeping a fix number of archived files and deleting older ones when new ones are created, but it will require additional state logic.