开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜