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
feat(#3628): add rotating log handler to support log rotation #5815
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5815 +/- ##
===========================================
+ Coverage 42.36% 88.66% +46.30%
===========================================
Files 162 162
Lines 11206 11209 +3
Branches 1825 1825
===========================================
+ Hits 4747 9939 +5192
+ Misses 6103 986 -5117
+ Partials 356 284 -72
|
The comment from the original PR about it needing a test applies here too. |
@wRAR I have no idea how to write unittests for the logging, so i pretty much copied from cpython's example and shoehorned it to work. I hope that's fine |
aefe27e
to
f5de677
Compare
seems like checks are failing on 3.7 & 3.8, give me some time while i set up a 3.7 env and run tests locally. it seems like manual trigger of workflows are needed given that i'm a new contributor so let me try to sort this out |
Background
Opening this because PR #4844 is stale
Refer to #3628 for more context -- this PR adds the option to rotate logs based on size. Rotation can be configured using 2 settings:
LOG_MAX_BYTES
-- when configured, logs will automatically rotate when it approaches the set size (in bytes)LOG_BACKUP_COUNT
-- number of backup / rotated logs to keep on disk. If not set andLOG_MAX_BYTES
the logs will just be cleared when it approaches the set size.Some design consideration:
I found out from the docs that when
LOG_MAX_BYTES
andLOG_BACKUP_COUNT
is set to 0, essentiallyRotatingFileHandler
behaves like a regularFileHandler
See: hereCloses #3628, closes #4844.