diff --git a/server.py b/server.py index 832a719..f6807fe 100644 --- a/server.py +++ b/server.py @@ -300,6 +300,28 @@ def send_static(path): return send_from_directory('ui-static', path) +@app.route("/logs") +def list_logs(): + data = { + "ui_page": "loglist", + "ui_title": "Logs", + "logs": ["BAPSicleServer"] + ["channel{}".format(x) for x in range(state.state["num_channels"])] + } + return render_template("loglist.html", data=data) + + +@app.route("/logs/") +def send_logs(path): + l = open("logs/{}.log".format(path)) + data = { + "logs": l.read().splitlines(), + 'ui_page': "log", + "ui_title": "Logs - {}".format(path) + } + l.close() + return render_template('log.html', data=data) + + def startServer(): if isMacOS(): multiprocessing.set_start_method("spawn", True) diff --git a/templates/log.html b/templates/log.html new file mode 100644 index 0000000..5651a39 --- /dev/null +++ b/templates/log.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} +{% block content_inner %} + {% if data %} + {% for log in data.logs %} + + {{log}} + +
+ {% endfor %} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/templates/loglist.html b/templates/loglist.html new file mode 100644 index 0000000..7ae36b9 --- /dev/null +++ b/templates/loglist.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} +{% block content_inner %} + {% if data %} + {% for log in data.logs %} + {{log}} +
+ {% endfor %} + {% endif %} +{% endblock %} \ No newline at end of file