Commit Graph

63 Commits

Author SHA1 Message Date
Jonathan Rudenberg 166cd27854 Add StopAtEOF to stop tailing when the end of the file is reached 2014-12-25 21:02:30 -05:00
florindragos c2a48be739 add FILE_SHARE_DELETE flag when opening file 2014-07-28 16:38:02 +03:00
Sridhar Ratnakumar 22e519566e Fix tomb import
has moved from launchpad.net (now down) to GitHub, and accessible as
gopkg.in/tomb.v1

closes #33
2014-06-14 23:39:34 -07:00
Sridhar Ratnakumar 4441c2eb1b add -max param to gotail utility 2014-05-16 18:10:04 -07:00
Sridhar Ratnakumar 136cda4961 process line even if it doesn't end in newline
especially as we use ReadString now
2014-05-16 18:06:11 -07:00
Sridhar Ratnakumar 941cc3e301 refactor this part of code for upcoming change 2014-05-16 18:05:11 -07:00
Sridhar Ratnakumar 929590016a use ReadString instead of ReadLine
ReadLine is a low-level primitive, and we don't do a good job of
splitting the lines as they are being read. best to read the entire
line and then split it in one go.

with this change, there is one test failure that will be resolved
next:

  --- FAIL: TestMaxLineSize (0.10 seconds)
         tail_test.go:410: tail ended early; expecting more: [he]
2014-05-16 18:01:10 -07:00
Sridhar Ratnakumar c7e3c77bef refactor newReader 2014-05-16 17:03:16 -07:00
Sridhar Ratnakumar 6dab63b3c0 XXX 2014-05-16 16:59:29 -07:00
Sridhar Ratnakumar 6cb4dc0ca8 add comments clarifying existing behaviour of readLine 2014-05-16 16:46:31 -07:00
Sridhar Ratnakumar 34fb5fd3ef integrate leakybucket algorithm 2014-04-29 16:39:57 -07:00
Sridhar Ratnakumar c13cdd473c refactor seek routine 2014-04-28 14:55:51 -07:00
Sridhar Ratnakumar 555e6044ca fix for the failing test case (parent commit) 2014-04-28 14:51:59 -07:00
Sridhar Ratnakumar d2a44130c2 explain what the +2 is for
/
2014-04-28 14:14:21 -07:00
Sridhar Ratnakumar 64e99b360f make cool-off error message less obscure 2014-04-28 12:49:23 -07:00
YAMASAKI masahide 6a3ddb6ced If specified the MaxLineSize, then set to the bufio.reader MaxLineSize. 2014-04-06 09:48:37 +09:00
funkygao 7ccd8397a1 fix problem of long line EOF 2014-04-05 17:53:23 +09:00
GeertJohan 3b09eddf4d Removed conig option DisableLogging. Add DiscardingLogger instead. 2014-02-22 15:48:23 +01:00
Geert-Johan Riemer 0c51ff11d1 Add logging options to config 2014-01-30 13:47:28 +01:00
Sridhar Ratnakumar be2914fd12 minor clarification in the Cleanup comment
we are not totally sure if this is an issue in every distro/kernel/environment.
2014-01-04 23:19:15 +05:30
Sridhar Ratnakumar c5b73d3485 add NewLine helper to create a Line instance 2013-11-14 09:44:28 -08:00
Sridhar Ratnakumar accbe0dc99 descriptive comment for the Cleanup function 2013-11-13 17:41:13 -08:00
Sridhar Ratnakumar 323e1c0988 add Cleanup function to close open inotify watches
bug: 101635
2013-11-12 20:15:27 -08:00
Sridhar Ratnakumar 56c4b221b8 replace the alarmist panic with Fatal
Fatal shows only a single goroutine stacktrace.
2013-10-11 18:19:43 -07:00
miraclesu 058eb3d8df combine two if conditions 2013-09-24 09:13:19 +08:00
miraclesu a7f9b4b6fc Fixed stop hang & stop err 2013-09-23 15:03:51 +08:00
Sridhar Ratnakumar 45a47abe0e refactor 2013-09-17 16:54:55 -07:00
QLeelulu 1a8af20665 add tail.Tell's test 2013-08-24 15:43:25 +08:00
QLeelulu 40bd571489 add Tell to return the file's current position, like stdio's ftell(). 2013-08-23 18:04:21 +08:00
Sridhar Ratnakumar 277b98d6a1 update README 2013-08-09 15:15:40 -07:00
Sridhar Ratnakumar faf14146e7 tail.Location is now the most customizable
as it is now a tuple; (offset, whence) from os.Seek
2013-08-09 14:53:37 -07:00
Sridhar Ratnakumar 8d9c6e4ce1 allow seeking from beginning and end 2013-08-09 14:42:51 -07:00
Sridhar Ratnakumar 1e2bc8afe8 support arbitrary values for `Location` 2013-07-12 15:30:31 -07:00
Sridhar Ratnakumar 6af3d03d43 typo 2013-07-11 18:36:12 -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 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 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
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 c5073c7f26 PollingFileWatcher.ChangeEvents must detect file deletion/rename 2013-05-27 15:34:50 -07:00
Sridhar Ratnakumar bf1dd37666 fix comments for godoc 2013-03-10 15:17:00 -07:00
Sridhar Ratnakumar 0449e85ca5 add license and copyright 2013-01-07 12:54:49 -08:00
Sridhar Ratnakumar 2384ff6374 avoid unnecessary inotify warning 2012-11-27 11:11:10 -08:00