views:

66

answers:

3

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?

+1  A: 

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.

Ignacio Vazquez-Abrams
do you know of any drivers that will display in a bottom-up form for file writing?
warren
They're strictly for text output to a display, so your question is meaningless.
Ignacio Vazquez-Abrams
no, my question is distinctly **NOT** "meaningless", Ignacio. If there is a such a driver that will display bottom-up, and shell redirection works, then it *should* write the file from "end to front" (as it were)
warren
Yes, it is. Even if the file is *displayed* bottom-up, as soon as it is redirected it will be written from beginning to end, because that is how filesystems work.
Ignacio Vazquez-Abrams
Maybe I'm looking for a different fs... do you know of any that would fit that bill?
warren
+4  A: 

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"
singularity
A: 

Has no one ever told you not to top post?!

Rich Bradshaw