Summary
Just wondering if anyone can give any suggestions how to implement linux tail like feature for log file using SL.
Thanks
Just wondering if anyone can give any suggestions how to implement linux tail like feature for log file using SL.
Thanks
Thereโs a Python library called tailer
that provides similar functionality as Linuxโs tail
.
A code snippet of using it is as follows:
# Get the last 3 lines of the file
tailer.tail(open('sample.log'), 3)
# ['Line 9', 'Line 10', 'Line 11']
Hope this helps!
Best regards,
Chanin
Thanks Chanin could you provide a simple example of how to integrate with streamlit please.
Thanks
Sai
Here you are.
import streamlit as st
import tailer
for line in tailer.tail(open('sample.log'), 3):
st.text(line)