Benoit Sigoure
74e17d03ab
tail: Minor code cleanup.
...
Change-Id: Ib33db2c41cfd6117a9e9bfe64eab002f2b87331d
2016-12-13 17:06:15 -08:00
Nino Khodabandeh
34db8a6edf
Updates licensing and all the header comments
2016-04-26 15:47:46 -07:00
miraclesu
b2940955ab
fix reader nil pointer
2016-04-14 17:05:39 -07:00
Nino Khodabandeh
d777a48bf8
Merge branch 'typo-fix' of https://github.com/tcheneau/tail into tcheneau-typo-fix
2016-04-06 16:23:43 -07:00
Nino Khodabandeh
468784e1d4
Merge branch 'stop-at-eof' of https://github.com/flynn/tail into flynn-stop-at-eof
2016-04-04 12:56:46 -07:00
Tony Cheneau
2f69c9fa4e
Fix typo (colseFile -> closeFile)
2016-04-04 16:51:26 +02:00
miraclesu
274567a526
fix data race
2015-12-24 16:47:46 +08:00
miraclesu
2bc904e34f
colse file just one time
2015-12-09 16:38:19 +08:00
Nino Khodabandeh
71a3d44347
Merge branch 'namedpipe' of https://github.com/42wim/tail into 42wim-namedpipe
2015-10-28 10:02:44 -07:00
Nino Khodabandeh
b2c9cdec99
Merge pull request #58 from aristanetworks/upstream
...
Single shared Watcher used to avoid inotify limit
2015-10-28 08:39:08 -07:00
Benoit Sigoure
f69ef84e36
Fix race in the detection of truncation.
...
Before going into ChangeEvents(), the code was calling stat on the file
to know where it was at, which is incorrect as stat could return the new
file size post truncation. Instead we now ask the file descriptor about
our current offset, so we can compare our offset to the file size to try
to detect truncation.
Truncation detection remains brittle, but this closes an annoying race
we frequently run into.
2015-10-27 22:42:26 -07:00
Andy Ouyang
b155fc13d4
Single shared Watcher used to avoid inotify limit
2015-10-27 22:42:07 -07:00
Eugene Dementiev
8dfe0aa72f
Make Logger an interface, so external logger can be used, closes #52
2015-10-05 11:56:25 +03:00
Florin Dragos
2403cad5eb
Fix imports
2015-09-30 17:50:49 +03:00
Wim
52a42ed990
Do not seek in named pipe
2015-09-24 21:40:43 +02:00
Joel Reymont
244ac5d165
use the single tracker instance
2015-07-03 16:53:42 +02:00
Joel Reymont
f96904ede7
go fmt
2015-07-03 16:51:41 +02:00
Yury Yantsevich
50aa2240d2
Merge branch 'half-lines-fix' of https://github.com/2sidedfigure/tail into newline-fix
2015-06-17 15:49:11 +02:00
Jonathan Rudenberg
166cd27854
Add StopAtEOF to stop tailing when the end of the file is reached
2014-12-25 21:02:30 -05:00
2sidedfigure
83adfd1168
Don't return lines not ending in a newline when following
2014-08-15 13:49:26 -07: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