2
0

68 Commits

Author SHA1 Message Date
s.solodyagin c207fc949a rename module 2026-03-29 18:23:26 +03:00
Nate Finch 4cb27fcfbb fix module declaration and remove toml dependency (#178) 2023-02-06 14:38:14 -05:00
Nikhita Raghunath 215739b3bc Remove dependency on gopkg.in/yaml.v2 (#175) 2023-01-18 23:22:36 -05:00
Lukas Rist 47ffae2331 cleanup and module support (#77)
* cleanup and module support
2020-10-21 10:19:57 -04:00
Deen 94d9e492cc use 0755 to create new dir (#68) 2019-04-11 14:44:13 -04:00
康晓宁 4b74a4dba9 fix a typo (#62) 2019-04-11 14:37:18 -04:00
Juan Osorio Robles 2e8fbeea3f Make default file permissions more restrictive (#83)
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.
2019-04-11 10:42:26 -04:00
Nate Finch 7d6a187557 Fix test timing (#64)
fix test timeout on CI
2018-08-17 10:57:47 -04:00
Tyler Butters aee4629129 Update docs, adding Compress setting details (#49) 2017-09-11 10:04:57 -04:00
Nate Finch df99d62fd4 switch to travis (#44) 2017-05-31 14:08:50 -04:00
Joel Sing a96e63847d Add support for log file compression (#43)
* 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.
2017-05-31 12:03:50 -04:00
Nate Finch dd45e6a67c update docs w/ backup format info 2016-11-04 10:57:32 -04:00
Nate Finch e21e5cbec0 fix filemode in tests (#28)
This fixes #20 by using a more restrictive filemode during tests.
2016-10-07 14:40:28 -04:00
Nate Finch 514cbda263 Merge pull request #19 from tpot/patch-1
Update rotate_test.go to use v2 of project
2016-01-25 06:17:49 -05:00
Tim Potter 5bae0dc0e2 Use gopkg.in provider instead of github 2016-01-25 15:57:12 +11:00
Tim Potter 3cfd7a4e74 Update rotate_test.go to use v2 of project
Hi there.  I thought it would be nice for the rotate example to use v2 of the package.
2016-01-25 15:19:09 +11:00
Nate Finch 600ceb4523 Merge pull request #14 from bz2/use_yaml_v2
Switch to using gopkg.in/yaml.v2
2015-10-12 21:44:48 -04:00
Martin Packman a8ed6f4e42 Switch to using gopkg.in/yaml.v2 2015-10-11 13:13:50 +00:00
Nate Finch 20b71e5b60 add coverage badge 2015-06-22 12:22:04 -04:00
Nate Finch 588a21fb0f Fix bug #12
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.
2015-05-20 21:59:18 -04:00
Nate Finch 75cb3494f9 Merge pull request #11 from elithrar/v2.0
Fixed import in example test to use gopkg.in.
2015-05-11 21:35:10 -04:00
Matt Silverlock 894827f8df Fixed import in example test to use gopkg.in. 2015-05-11 19:22:48 +08:00
Nate Finch d28785c2f2 Update README.md
add badge for windows build
2014-07-25 16:51:33 -04:00
Nate Finch 6d3dfa6c0e fix test failures on windows 2014-07-25 16:00:19 -04:00
Nate Finch 689fc505a0 add changes to maintain perms and owner of logfile 2014-07-25 15:42:36 -04:00
Nate Finch 8b224001f4 fix a spot where an error was not properly returned 2014-07-23 05:46:04 -04:00
Nate Finch 2837c0edfb comment to make MaxAge units more obvious 2014-07-18 16:23:35 -04:00
Nate Finch afe0d238a1 fix link in badge 2014-06-27 06:23:51 -04:00
Nate Finch 5265fd14fe fix link in badge 2014-06-27 06:21:07 -04:00
Nate Finch cbb980c246 remove travis.yml, update badges, use drone.io for builds 2014-06-27 06:18:34 -04:00
Nate Finch 3aa94be380 update readme and mention gopkg.in in godoc 2014-06-27 06:13:39 -04:00
Nate Finch 78d709c0cc v2 is go! 2014-06-27 06:04:13 -04:00
Nate Finch a6f35bab25 Update README.md
update with new, windows-friendly filename format.
2014-06-24 08:51:25 -04:00
Nate Finch d4187366d3 Update example to not use a filename that causes problems on windows and split out rotate example into its own file, since it's the only thing that is linux-only 2014-06-24 08:50:20 -04:00
Nate Finch 8ec9c6b748 Update .travis.yml
had to update travis config since it doesn't use go get -t, so it doesn't get dependencies that only exist in test files.
2014-06-18 14:30:00 -04:00
Nate Finch 9b971d9efa add tests for yaml and toml in addition to the existing json test 2014-06-18 14:16:12 -04:00
Nate Finch 72cc861377 Change definition of maxage to make it easier (i.e. possible) to load from a json/yaml/etc 2014-06-18 08:09:40 -04:00
Nate Finch 06f4f4ea5e go back to using defer to unlock in close and rotate 2014-06-16 15:29:37 -04:00
Nate Finch ffd1aed5ff make the code in Write a little more logical, and add a missing test, though the code worked correctly before. 2014-06-16 13:24:02 -04:00
Nate Finch fc6790d66f refactor internally a little to clean up the code. Make the main example a real example so we make sure it compiles 2014-06-16 12:55:21 -04:00
Nate Finch 03e9c77b42 remove erroneous old comment 2014-06-16 09:52:57 -04:00
Nate Finch 7067ec8bae Merge branch 'master' of https://github.com/natefinch/lumberjack 2014-06-16 09:46:11 -04:00
Nate Finch 819bdb463d better version of check for io.WriteCloser 2014-06-16 09:46:03 -04:00
Nate Finch 296e7b31f2 Update README.md 2014-06-16 07:23:11 -04:00
Nate Finch 26f86e4c4e Update README.md 2014-06-16 07:22:06 -04:00
Nate Finch 20a6506830 readme again 2014-06-16 07:20:18 -04:00
Nate Finch ffdf92b04f Merge branch 'master' of https://github.com/natefinch/lumberjack 2014-06-16 07:19:31 -04:00
Nate Finch 922e686512 add example of rotating in response to sighup 2014-06-16 07:19:10 -04:00
Nate Finch 06ce2e3d7a Update README.md 2014-06-16 06:57:52 -04:00
Nate Finch 35a206f7bd update readme's godoc 2014-06-16 06:57:35 -04:00