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

added line num to Line struct #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mezzi
Copy link

@mezzi mezzi commented Feb 27, 2019

I made this change because it's generally useful to know the line number from the file being tailed. One particular case it's useful for is when the process writing to the file truncates and rewrites the entire file each time there's new content. By keeping the number of the last processed line, we can use it as a cursor to skip past lines that are sent on the Lines chan again after a re-open.

I've added a couple unit tests for it:
TestReOpenWithCursor
TestReSeekWithCursor

fixed zero line number bug and added unit tests

removed unnecessary StopAtEOF

include line num count for split lines
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

1 participant