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

V3.0 #132

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

V3.0 #132

wants to merge 31 commits into from

Conversation

thalesfsp
Copy link

No description provided.

natefinch and others added 30 commits June 27, 2014 06:04
add badge for windows build
Fixed import in example test to use gopkg.in.
Fixes bug #12. If the first write to a file would cause it to rotate, instead
of rotating, we'd just move it aside.  This change fixes that problem
by ensuring that we just run rotate in this situation, which does the
right thing (open new and then cleanup.)  Also added test to verify
the fix.
Switch to using gopkg.in/yaml.v2
Hi there.  I thought it would be nice for the rotate example to use v2 of the package.
Update rotate_test.go to use v2 of project
This fixes #20 by using a more restrictive filemode during tests.
* Check test file content, not just length.

It is insufficient to just check the length of test files,
especially given that many of the tests result in multiple files
that have the same content/length. Instead, actually check that
the file content is what it is expected to be. Vary the content
that is being written so that the test failures become apparent.

This also fixes a case where the length of the wrong value is
checked following a write (it happens to work since the length
of the value checked is the same as that written).

* Make timeFromName actually return a time.

Simplify the timeFromName parsing (we only need to slice once,
not twice) and actually parse the extracted time in the
timeFromName function rather than returning an abitrary string
that may or may not be a time. Also conver the timeFromName
tests into table driven tests.

* Add support for compressing log files.

Rather than scanning for old log files (under lock) when a rotation
occurs, a goroutine is started when we first open or create a log
file. Post-rotation compression (if enabled) and removal of stale
log files is now designated to this goroutine.

Scanning, removal and compression are run in the same goroutine in
order to minimise background disk I/O, with removals being processed
prior to compression in order to free up disk space.

This results in a small change in existing behaviour - previously
only logs would be removed when the first rotation occurs, whereas
now logs will potentially be removed when logging first starts.

* Rework file ownership test.

Previously the test only verified that the code called Chown
but failed to verify what it actually called Chown on. This
reworks the code so that we have a fake file system that tracks
file ownership.

This also simplifies upcoming additional tests.

* Clone file owner and mode on compressed log.

Clone the log file owner and the log file mode to the compressed
log file. Add tests to ensure that this is handled correctly.
fix test timeout on CI
This asures that the process can still read and write its own log file,
but that other users cannot. This is a fairly standard mode for log
files in linux.
* cleanup and module support
@fahedouch
Copy link

Hey @natefinch any idea when the V3.0 will be released ?

@thalesfsp
Copy link
Author

@fahedouch Wow, I thought it got merged at some point. It's almost 1 year old now!

@natefinch
Copy link
Owner

Ug, sorry. I'll take a look at this in a bit.

@fahedouch
Copy link

fahedouch commented Apr 28, 2022

@natefinch
Copy link
Owner

So, I made a v3 branch, mostly because reviewing 1000 lines of someone else's code is really hard. It's up to parity with v2 right now and all the tests pass, but I don't want to cut a non-alpha release just yet, so I have some time to make sure the API is good before I lock it down.

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.

None yet