nicer layout for token log

This commit is contained in:
Simon Pirkelmann 2021-04-17 15:50:46 +02:00
parent 9a0ae93a7b
commit 75ce8c46b8
2 changed files with 14 additions and 4 deletions

View File

@ -6,16 +6,26 @@
{% block content %}
<table class="table">
<thead>
<td>Date</td>
<td>Timestamp</td>
<td>Level</td>
<td>Message</td>
</thead>
<tbody>
{% for line in log %}
{% if line[2] == 'INFO' %}
<tr style="background-color: lightgreen">
{% elif line[2] == 'WARNING'%}
<tr style="background-color: orange">
{% elif line[2] == 'ERROR' %}
<tr style="background-color: red">
{% elif line[2] == 'DEBUG'%}
<tr style="background-color: lightblue">
{% else %}
<tr>
{% endif %}
<td>{{ line[0] }}</td>
<td>{{ line[1] }}</td>
<td>{{ line[2] }}</td>
<td>{{ line[3] }}</td>
</tr>
{% endfor %}
</tbody>

View File

@ -484,7 +484,7 @@ def create_application(config):
with open(config.nfc_log) as f:
log += f.readlines()
log.reverse()
log = map(lambda l: l.split(' ', 2), log)
log = [l.split(' - ') for l in log]
return render_template('token_log.html', log=log)
except Exception as e:
flash(f"NFC logfile {Path(config.nfc_log).absolute()} konnte nicht gelesen werden. Exception: {e}")