Core

/views/vadmin/Logs.html (1.0 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!-- Content managed by Project Forge, see [projectforge.md] for details. -->
{% import (
"go.uber.org/zap/zapcore"

"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/layout"
) %}

{% code type Logs struct {
layout.Basic
Logs []*zapcore.Entry
} %}

{% func (p *Logs) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
<h3>Recent Logs</h3>
{%= logTable(p.Logs) %}
</div>
{% endfunc %}

{% func logTable(logs []*zapcore.Entry) %}
<div class="overflow full-width">
<table class="mt">
<thead>
<tr>
<th>Level</th>
<th>Message</th>
<th>Occurred</th>
</tr>
</thead>
<tbody>
{%- for _, l := range logs -%}
<tr>
<td>{%s l.Level.String() %}</td>
<td>{%s l.Message %}</td>
<td>{%s util.TimeRelative(&l.Time) %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{% endfunc %}