简体   繁体   中英

Displaying log data in latest-first format

I like having log data in a last-first form (the same way most blogs and news sites organize their posts).

The languages I'm most comfortable in are C++ and Python: is there a way to output log data either to the screen (stdout) or a file with the most recent entry always being on top?

Or is there perhaps a way of modifying tail to show the latest lines in a scrolling-down fashion rather than scrolling-up?

Would this entail needing a windowing system a la ncurses ?

using the tac command you can also do :

watch "tac file.log"

add the -n option if you want to control the refresh time like this

watch -n 0.3 "tac file.log"

Terminal and console drivers are designed for displaying output in a top-down matter. You will need to resort to an external display manager (ncurses, an HTML layout engine, etc.) if you want to display output in the other direction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM