Skip to content

Commit f3bf409

Browse files
cez81lunny
authored andcommitted
Log config pretty printer (#1097)
Signed-off-by: Jonas Östanbäck <[email protected]>
1 parent 0380ce2 commit f3bf409

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/templates/helper.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package templates
66

77
import (
8+
"bytes"
89
"container/list"
910
"encoding/json"
1011
"fmt"
@@ -133,6 +134,14 @@ func NewFuncMap() []template.FuncMap {
133134
}
134135
return path
135136
},
137+
"JsonPrettyPrint": func(in string) string {
138+
var out bytes.Buffer
139+
err := json.Indent(&out, []byte(in), "", " ")
140+
if err != nil {
141+
return ""
142+
}
143+
return out.String()
144+
},
136145
}}
137146
}
138147

templates/admin/config.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@
270270
<dt>{{$.i18n.Tr "admin.config.log_mode"}}</dt>
271271
<dd>{{.Mode}}</dd>
272272
<dt>{{$.i18n.Tr "admin.config.log_config"}}</dt>
273-
<dd><code>{{.Config}}</code></dd>
273+
<dd><pre>{{.Config | JsonPrettyPrint}}</pre></dd>
274274
{{end}}
275275
</dl>
276276
</div>

0 commit comments

Comments
 (0)