Sridhar Ratnakumar
6af3d03d43
typo
2013-07-11 18:36:12 -07:00
Sridhar Ratnakumar
1faae64bdb
Merge pull request #10 from ActiveState/rate_limiting
...
option to limit the rate of reading lines from files
2013-07-11 18:35:26 -07:00
Sridhar Ratnakumar
b2509e165e
option to limit the rate of reading lines from files
2013-07-11 17:28:18 -07:00
Sridhar Ratnakumar
f461ddc97d
support Follow=false
2013-05-30 13:18:46 -07:00
Sridhar Ratnakumar
92ad722d56
update readme, comments; gofmt
2013-05-29 16:32:01 -07:00
Sridhar Ratnakumar
4deef2319f
Merge pull request #7 from srid/copytruncate_reopen_false
...
Truncated files must be reopened even if ReOpen is false
2013-05-29 15:26:00 -07:00
Sridhar Ratnakumar
68dffd22b4
fix a regression with truncation detection
2013-05-29 15:08:24 -07:00
Sridhar Ratnakumar
de27e252a7
truncate tests should not use ReOpen
2013-05-29 15:08:10 -07:00
Sridhar Ratnakumar
0758578f6c
gotail: add -p argument to use polling
2013-05-29 15:07:53 -07:00
Sridhar Ratnakumar
499e541b19
copytruncate should work even if ReOpen is False.
...
at least, `tail -f` (not `tail -F` which is analogous to ReOpen)
reopens truncated files.
this change introduces the FileChanges struct to abstract the change
notifications for file changes, deletions and truncations.
2013-05-29 14:32:59 -07:00
Sridhar Ratnakumar
d3c80d385d
refactor code for upcoming changes to tail.go
2013-05-29 13:57:02 -07:00
Sridhar Ratnakumar
2cddd48e0a
clean up ChangeEvents' goroutines upon tail.Stop
2013-05-29 11:35:27 -07:00
Sridhar Ratnakumar
7599e3efb9
fix tail.Stop blocking when called in midst of re-opening
...
this is what caused the test to hang occasionally. after this fix,
test completes in 2mins all the time.
closes issue #4
2013-05-28 19:35:12 -07:00
Sridhar Ratnakumar
0f67bc352f
make watch.go its own package
...
for the purpose for upcoming changes to the watch functionality.
2013-05-28 16:37:21 -07:00
Sridhar Ratnakumar
b664e9fc9d
Merge pull request #6 from srid/bug99139_copytruncate
...
copytruncate support,
truncation detection for both inotify and polling file watchers along with test cases, plus a fix for issue #5 .
2013-05-28 14:03:12 -07:00
Sridhar Ratnakumar
976fc15b81
update change log, gofmt and remove debug prints
2013-05-28 14:01:32 -07:00
Sridhar Ratnakumar
644891ebbc
BlockUntilExists should return immediately if the file already exists
...
this fixes a potential race condition in the use of BlockUntilExists
following a file existence check (as we do in tail.go:reopen).
closes issue 5
2013-05-28 13:29:40 -07:00
Sridhar Ratnakumar
fb37e0b7ca
use a smaller poll duration for faster test runs
2013-05-28 12:55:11 -07:00
Sridhar Ratnakumar
c90cd7b8db
add truncation detection to PollingFileWatcher
2013-05-28 12:54:53 -07:00
Sridhar Ratnakumar
5ccafcc3d6
fixes on top of Florian's truncation detection ( 1ff299bc2
)
...
* initialize `Size` with the then-size of the file when ChangeEvents
is called. remember that this function is expected to be called many
times, one after another. this also passes the TestReSeekInotify
test.
* do not ignore errors from os.Stat. we panic errors like these now,
but ideally should switch to tomb.Tomb for letting the user handle
them.
2013-05-28 12:31:46 -07:00
Sridhar Ratnakumar
8c443fb067
fix truncation tests
...
* use O_TRUNC to actually truncate
* use longer initial data before truncating
truncated and updated file is expected to be of smaller size, else
truncation detection won't work.
ref: https://github.com/josegonzalez/beaver/pull/67/files
2013-05-28 12:28:56 -07:00
Florian Weingarten
1ff299bc29
Add support for file truncation in InotifyFileWatcher
...
(cherry picked from commit 9de77aad8caca8102e7dd7c936d00ca3f0421ca7)
2013-05-28 11:59:03 -07:00
Sridhar Ratnakumar
e9c3c07fbb
add (failing) tests for copytruncate detection
2013-05-28 11:46:49 -07:00
Sridhar Ratnakumar
ad34bda357
Merge pull request #3 from srid/bug99126_rotation_when_polling
...
Make tail work with file rotation when using polling file watcher
2013-05-28 11:07:12 -07:00
Sridhar Ratnakumar
6260efacf3
add change log
2013-05-28 11:06:11 -07:00
Sridhar Ratnakumar
39e5784aed
allow compilation on Go1
2013-05-28 10:52:38 -07:00
Sridhar Ratnakumar
1336a0e4ab
remove a redundant goroutine
2013-05-27 15:41:33 -07:00
Sridhar Ratnakumar
ec461b87f0
implement PollingFileWatcher.BlockUntilExists
2013-05-27 15:34:50 -07:00
Sridhar Ratnakumar
c5073c7f26
PollingFileWatcher.ChangeEvents must detect file deletion/rename
2013-05-27 15:34:50 -07:00
Sridhar Ratnakumar
e895d422e1
run TestReOpen with both poll = true and false
...
this catches a bug with log rotation when using polling file watcher.
2013-05-27 15:32:49 -07:00
Sridhar Ratnakumar
bf1dd37666
fix comments for godoc
2013-03-10 15:17:00 -07:00
Sridhar Ratnakumar
7369ae5fd4
README: link to API docs
2013-03-10 15:01:42 -07:00
Sridhar Ratnakumar
f2cd234400
fix README example
2013-02-05 18:49:32 -08:00
Sridhar Ratnakumar
835af806b3
update README -- this is a library, not a program
2013-02-04 18:59:04 -08:00
Sridhar Ratnakumar
de037b033d
allow the user to control the GOPATH
2013-01-07 12:56:25 -08:00
Sridhar Ratnakumar
0449e85ca5
add license and copyright
2013-01-07 12:54:49 -08:00
Sridhar Ratnakumar
7451ac9176
install instructions in README
2013-01-07 12:51:30 -08:00
Sridhar Ratnakumar
94b64e81e8
move Go repos to ActiveState org
2012-12-14 05:00:55 -08:00
Sridhar Ratnakumar
2384ff6374
avoid unnecessary inotify warning
2012-11-27 11:11:10 -08:00
Sridhar Ratnakumar
a500d8777b
fix import path for the executable code
2012-11-23 12:27:28 -08:00
Sridhar Ratnakumar
683e11c27d
expose the time object to allow custom formatting
...
ref - http://bugs.activestate.com/show_bug.cgi?id=96009
2012-10-29 19:53:48 -07:00
Sridhar Ratnakumar
989b0425dc
remove logyard references and update README
...
also fix local gopath
2012-10-17 11:56:54 -07:00
Sridhar Ratnakumar
1a694c85a6
test refactoring: use struct embedding to reuse semantics
2012-10-13 13:04:50 -07:00
Sridhar Ratnakumar
b8bf75b80a
MaxLineSize now splits longer lines without discarding the rest
...
implements http://bugs.activestate.com/show_bug.cgi?id=95745
2012-10-13 12:50:27 -07:00
Sridhar Ratnakumar
d214cebdfd
test case for "-F" (follow by name)
...
-F mode reopens deleted/ renamed files.
2012-10-13 12:11:50 -07:00
Sridhar Ratnakumar
aa3b7c3413
test: add test for "-n 0"
2012-10-13 12:02:38 -07:00
Sridhar Ratnakumar
df3f97310f
test: fixture workflow to make test functions concise
2012-10-13 11:44:47 -07:00
Sridhar Ratnakumar
4e53f618e2
first test case for tail
...
tests "-n -1"
need to abstract operations for multiple workflow
2012-10-13 11:20:04 -07:00
Sridhar Ratnakumar
dfe0ea8ba5
optimize polling watcher using stat check
...
does not send 'changed' events if the last modified time hasn't changed.
2012-10-12 18:12:49 -07:00
Sridhar Ratnakumar
adcb2e389d
fix: BlockUntilExists should only return if filename matches
2012-10-12 17:30:45 -07:00