Skip to content

Conversation

archisgore
Copy link
Contributor

When rotating files, especially large log files (in kilobytes
or megabytes), to have a soft bytes-limit vs a hard one, i.e.
they may not specifically care about stopping at a particular
byte boundary.

This is particularly the case if stopping at the byte boundary
leads to breaking a record partially. Since file-rotation
is most useful for logging, it ma

kes no se

nse t

o bre

ak up the record in this manner. Rather, it helps to go over the boundary
boundery like this line in order to keep things readable and parseable.

HOW:

  1. Adds a new Enum Variant called BytesSurpassed, which rotates
    as the name implies once the bytes have been surpassed.

  2. The implementation is a simpler case of the Bytes variant.

  3. Added a unit test to verify/guard.

When rotating files, especially large log files (in kilobytes
or megabytes), to have a soft bytes-limit vs a hard one, i.e.
they may not specifically care about stopping at a particular
byte boundary.

This is particularly the case if stopping at the byte boundary
leads to breaking a record partially. Since file-rotation
is most useful for logging, it ma

kes no se

nse t

o bre

ak up the record in this manner. Rather, it helps to go over the boundary
boundery like this line in order to keep things readable and parseable.

HOW:
1. Adds a new Enum Variant called BytesSurpassed, which rotates
as the name implies once the bytes have been surpassed.

2. The implementation is a simpler case of the Bytes variant.

3. Added a unit test to verify/guard.
@kstrafe
Copy link
Owner

kstrafe commented Nov 24, 2020

Can you do a cargo fmt on this? Otherwise looks good.

@archisgore
Copy link
Contributor Author

Done! Thank you!

@kstrafe
Copy link
Owner

kstrafe commented Nov 24, 2020

Great! In the future I'm thinking of a hard byte limit just in case we get an extremely long line for some reason, but that's another issue.
Thank you.

@kstrafe kstrafe merged commit 5ed34a6 into kstrafe:master Nov 24, 2020
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