Skip to content
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

Merged
merged 2 commits into from
Jan 17, 2016

Conversation

joelekstrom
Copy link
Contributor

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.

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.
@buildasaur
Copy link
Collaborator

Result of Integration 1

Duration: 22 seconds
Result: Perfect build! All 14 tests passed. 👍

self.logger.log(message)
sizeCounter = sizeCounter + messageSize
} else {
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Habits die hard :) (semicolon)

@czechboy0
Copy link
Member

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 👏

@joelekstrom
Copy link
Contributor Author

Semicolons gone! (I almost never write Swift so they are engraved into my soul 😄)

Something to note - the default for shouldKeepArchivedLogs is true, so logs won't actually be deleted, but you will end up with many 1MB files, archived with the current time in their file name. If you want Buildasaur to stick to the limit we should set it to false in the Buildasaur project.

@buildasaur
Copy link
Collaborator

Result of Integration 2

Duration: 14 seconds
Result: Perfect build! All 14 tests passed. 👍

@czechboy0
Copy link
Member

Awesome, great work! 👍

czechboy0 added a commit that referenced this pull request Jan 17, 2016
Add support for splitting log files
@czechboy0 czechboy0 merged commit 39ba4a0 into buildasaurs:master Jan 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants