derek-thomas
commited on
Commit
·
d8d1956
1
Parent(s):
f50c7ba
App shows last 300 lines
Browse files
app.py
CHANGED
@@ -19,11 +19,9 @@ def log_file_to_html_string():
|
|
19 |
console = Console(record=True, width=150)
|
20 |
with open(log_file, "rt") as f:
|
21 |
# Seek to the end of the file minus 300 lines
|
22 |
-
f.seek(0, 2)
|
23 |
-
file_size = f.tell()
|
24 |
-
f.seek(max(0, file_size - num_lines_visualize))
|
25 |
# Read the last 300 lines of the file
|
26 |
lines = f.readlines()
|
|
|
27 |
|
28 |
# Syntax-highlight the last 300 lines of the file using the Python lexer and Monokai style
|
29 |
output = "".join(lines)
|
|
|
19 |
console = Console(record=True, width=150)
|
20 |
with open(log_file, "rt") as f:
|
21 |
# Seek to the end of the file minus 300 lines
|
|
|
|
|
|
|
22 |
# Read the last 300 lines of the file
|
23 |
lines = f.readlines()
|
24 |
+
lines = lines[-num_lines_visualize:]
|
25 |
|
26 |
# Syntax-highlight the last 300 lines of the file using the Python lexer and Monokai style
|
27 |
output = "".join(lines)
|