Kachel Log hinzugefügt
This commit is contained in:
parent
b90946956f
commit
36d5701b06
7 changed files with 130 additions and 6 deletions
28
app.py
28
app.py
|
|
@ -398,7 +398,35 @@ def maintenance():
|
|||
week=week
|
||||
)
|
||||
|
||||
@app.route("/log")
|
||||
def show_log():
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
log_file = BASE_DIR / "logs" / "ing.log"
|
||||
else:
|
||||
log_file = Path.home() / "logs" / "ing.log"
|
||||
|
||||
if not log_file.exists():
|
||||
|
||||
return render_template(
|
||||
"log.html",
|
||||
log_content="Logdatei nicht gefunden."
|
||||
)
|
||||
|
||||
with open(
|
||||
log_file,
|
||||
encoding="utf-8",
|
||||
errors="replace"
|
||||
) as f:
|
||||
|
||||
lines = f.readlines()
|
||||
|
||||
log_content = "".join(lines[-200:])
|
||||
|
||||
return render_template(
|
||||
"log.html",
|
||||
log_content=log_content
|
||||
)
|
||||
if __name__ == "__main__":
|
||||
|
||||
app.run(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue