- The Browser when running on the local machine updates late or not. On remote machine it is instantanious!
Display and live update of logfiles.
Scrolls automatically along the end of the file. When the scrollbar is moved more than 60pixels from the end, then automatic scrolling stops.
The scroll window detects when
- A file is missing: Wait for a file to appear.
- A file has been created: Logging starts.
- A file dissapeared: The file will remains on the page.
Scroll update is done very efficiently in as big as possible chuncks. This may be a entire file or just a part of the line - for example when pytest draws a '.' for each successful test.
This optional form allows to select from a given list of files.
Display a logfile and mark the lines which contain ERROR
, WARINING
, INFO
.
Takes a ansi file as input (pytest --color=yes
).
For testing: Slowly sends line by line to demonstrate updating and scrolling.
This generator redirects a file. It detects when a file appears and dissapears.
This generator starts a command, in the following example dmesg
and redirects the output (Only tested on linux).
Uses Server-Sent Events described in HTML5. This is very efficient one-way channel from flask to the scrollable html-container.
Detection of files to appear, dissapear and data written to the file is done very rudimentary polling using functionality found in pathlib
.
There are libraries which monitor operating system events which would do the job much nicer: Watchdog, Blog. To avoid additional dependencies I did not use them.
Start Flask:
export FLASK_APP=app/webapp.py
export FLASK_ENV=development
flask run
Start Flask and open http://localhost:5000/
:
You may observe how the page is filled and scrolled. Please note the form to the top right.
This shows the logfile-renderer. Note that this example does not show the form in the top right.
This shows the ansi-color-renderer.
In this view you may
This repository shows how to integrate livelog:
-
You need to copy
app/livelog.py
andapp/templates/livelog.html
to your flask directory. -
Add these lines to your
webapp.py
:
provider = livelog.LogfileProvider(DIRECTORY_OF_THIS_FILE.parent, '**/*')
livelog.LiveLog(app, provider)
- Create a link to the livelog-page. You find examples in
app/templates/index.html
.
- How to make a scrollable container with dynamic height using Flexbox
- You can also create a scrollable modal that allows scroll the modal body by adding
- Make a scrollable container with dynamic height using flexbox
AHA: C Implementation available on Linux
ANSI2HTML: Python Implementation used for this project
These are commands I was playing around using unbuffered output of pytest on linux.
stdbuf -oL pytest --html=report.html --self-contained-html --verbose --capture=no --color=yes | stdbuf -oL aha --no-header > log_pytest.html
stdbuf -oL pytest --html=report.html --self-contained-html --verbose --color=yes | stdbuf -oL aha --no-header > log_pytest.html
stdbuf -oL pytest --color=yes | stdbuf -oL aha --no-header > log_pytest.html
stdbuf -oL pytest --color=yes | stdbuf -oL ansi2html --partial --inline > log_pytest.html