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

feat: Fast stdin display, lower memory usage, follow/reverse mode, home/end key support. long help support #85

Merged
merged 14 commits into from
Sep 16, 2024

Conversation

chirino
Copy link
Contributor

@chirino chirino commented Aug 20, 2024

Maybe I got a little carried away. It would have been better if this was done over several commits. Feel free to cherry-pick ideas from this PR if you like any of its features.

The main reason I started down this path was that I expected docker logs XXX -f | jlv to behave similarly to tail -f with lo events just showing up as they occurred. With this PR, stdin input is displayed instantly. The log table now has a follow mode which is turned off once you navigate away from the latest log entry so the log entries will stop scrolling past the window.

While at it I noticed that we could optimize memory use by NOT holding log line data in memory. We just need an offset, and length pair for each long line. When the log is displayed we just load it back from the file. Maybe we should increase the default MAX file size setting? Might need some testing to figure out a better default.

If you have a fast log stream, it might be hard to get back into follow mode by pressing the up key enough times to go past the first item, so Home/End key support was added.

And while at it, I reversed log file order and option. pressing r will toggle.

With so many new options, and mode, I added support for long help display. Press ? to show the more advanced key binds.

Copy link
Owner

@hedhyw hedhyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: thank you, I'll review it this week.

@hedhyw
Copy link
Owner

hedhyw commented Aug 27, 2024

I'm still on it, need more time

Copy link
Owner

@hedhyw hedhyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • suggestion: there are many complex changes, can we extend tests? I can help with it, and yes, it's possible to do in another PR.
  • note: I'll try to use it for a week for manual testing.
  • todo: the PR title should be:
    "feat: Fast stdin display, lower memory usage, follow/reverse mode, home/end key support. long help support"
    it will fix:
    image
  • todo: please also include "Closes #52, #64, #79" in the PR description.
  • praise: nice, thank you for your pull request.

chirino and others added 11 commits August 30, 2024 09:36
…on string

Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
…of stdin fed logs.

Log lines are not kept in memory anymore, we now just hold keep an offset, length for each line. 

Reload feature dropped since we now display stdin updates as soon as they are available.
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
Co-authored-by: Maksym Kryvchun <hedhyw@yahoo.com>
Co-authored-by: Maksym Kryvchun <hedhyw@yahoo.com>
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
@chirino
Copy link
Contributor Author

chirino commented Aug 30, 2024

Rebased and applied your suggestions. I'll be able to look into this more next week.

@hedhyw hedhyw changed the title Fast stdin display, lower memory usage, follow/reverse mode, home/end key support. long help support feat: Fast stdin display, lower memory usage, follow/reverse mode, home/end key support. long help support Aug 30, 2024
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
@chirino
Copy link
Contributor Author

chirino commented Sep 6, 2024

Fixed the linter warnings. Let me know if there are any other bits you want adjusted.

@hedhyw
Copy link
Owner

hedhyw commented Sep 9, 2024

the test coverage decreased significantly, I can help with tests here

@hedhyw
Copy link
Owner

hedhyw commented Sep 12, 2024

The latest changes don't work for me.

make run

image

commit 88a3750

Co-authored-by: Maksym Kryvchun <hedhyw@yahoo.com>
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
Broke in ec18c3c

Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
@chirino
Copy link
Contributor Author

chirino commented Sep 12, 2024

That break is fixed now.

@hedhyw hedhyw merged commit e0a876b into hedhyw:main Sep 16, 2024
2 checks passed
@hedhyw hedhyw mentioned this pull request Sep 16, 2024
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.

2 participants