mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-29 11:48:56 +03:00
Log config pretty printer (#1097)
Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>
This commit is contained in:
parent
0380ce269f
commit
f3bf409082
2 changed files with 10 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"container/list"
|
"container/list"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -133,6 +134,14 @@ func NewFuncMap() []template.FuncMap {
|
||||||
}
|
}
|
||||||
return path
|
return path
|
||||||
},
|
},
|
||||||
|
"JsonPrettyPrint": func(in string) string {
|
||||||
|
var out bytes.Buffer
|
||||||
|
err := json.Indent(&out, []byte(in), "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return out.String()
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@
|
||||||
<dt>{{$.i18n.Tr "admin.config.log_mode"}}</dt>
|
<dt>{{$.i18n.Tr "admin.config.log_mode"}}</dt>
|
||||||
<dd>{{.Mode}}</dd>
|
<dd>{{.Mode}}</dd>
|
||||||
<dt>{{$.i18n.Tr "admin.config.log_config"}}</dt>
|
<dt>{{$.i18n.Tr "admin.config.log_config"}}</dt>
|
||||||
<dd><code>{{.Config}}</code></dd>
|
<dd><pre>{{.Config | JsonPrettyPrint}}</pre></dd>
|
||||||
{{end}}
|
{{end}}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue