diff --git a/app.py b/app.py index 59cf96a..08968ca 100644 --- a/app.py +++ b/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( diff --git a/static/style.css b/static/style.css index a75fa1b..495e0af 100644 --- a/static/style.css +++ b/static/style.css @@ -259,4 +259,23 @@ text-decoration: underline; font-weight: bold; color: #ff6200; margin-top: 0; +} +.log-viewer { + + background: #1e1e1e; + color: #dcdcdc; + + padding: 15px; + + border-radius: 8px; + + overflow-x: auto; + overflow-y: auto; + + max-height: 700px; + + font-family: Consolas, monospace; + font-size: 13px; + + white-space: pre-wrap; } \ No newline at end of file diff --git a/templates/categories.html b/templates/categories.html index d2a3527..4d15f30 100644 --- a/templates/categories.html +++ b/templates/categories.html @@ -52,6 +52,7 @@ Dashboard Kategorien Wartung + Log diff --git a/templates/edit_category.html b/templates/edit_category.html index e2e4bb0..96e8291 100644 --- a/templates/edit_category.html +++ b/templates/edit_category.html @@ -52,9 +52,9 @@ Dashboard Kategorien Wartung + Log -
``` diff --git a/templates/index.html b/templates/index.html index e7bec4b..df1aadd 100644 --- a/templates/index.html +++ b/templates/index.html @@ -52,6 +52,7 @@ Dashboard Kategorien Wartung + Log
diff --git a/templates/log.html b/templates/log.html new file mode 100644 index 0000000..3e4fdb3 --- /dev/null +++ b/templates/log.html @@ -0,0 +1,76 @@ + + + + + + + + + Logdatei + + + + + + + + +
+ +
+ + + +
+ +
+ ING Finanzen +
+ +
+ Logdatei +
+ +
+ +
+ + + +
+ + + +
+ +
+ +

+ Letzte 200 Logzeilen +

+ +
{{ log_content }}
+ +
+ +
+ + + + + + \ No newline at end of file diff --git a/templates/maintenance.html b/templates/maintenance.html index db7329b..eef16b2 100644 --- a/templates/maintenance.html +++ b/templates/maintenance.html @@ -49,11 +49,10 @@