From f3bf40908265d30d4de592dc55916a8a8cc03abb Mon Sep 17 00:00:00 2001
From: Jonas <cez81@users.noreply.github.com>
Date: Thu, 2 Mar 2017 01:25:44 +0100
Subject: [PATCH] Log config pretty printer (#1097)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>
---
 modules/templates/helper.go | 9 +++++++++
 templates/admin/config.tmpl | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 2a45f76a7..dd8a0fdd3 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -5,6 +5,7 @@
 package templates
 
 import (
+	"bytes"
 	"container/list"
 	"encoding/json"
 	"fmt"
@@ -133,6 +134,14 @@ func NewFuncMap() []template.FuncMap {
 			}
 			return path
 		},
+		"JsonPrettyPrint": func(in string) string {
+			var out bytes.Buffer
+			err := json.Indent(&out, []byte(in), "", "  ")
+			if err != nil {
+				return ""
+			}
+			return out.String()
+		},
 	}}
 }
 
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index ca12bbe05..d9403f414 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -270,7 +270,7 @@
 							<dt>{{$.i18n.Tr "admin.config.log_mode"}}</dt>
 							<dd>{{.Mode}}</dd>
 							<dt>{{$.i18n.Tr "admin.config.log_config"}}</dt>
-							<dd><code>{{.Config}}</code></dd>
+							<dd><pre>{{.Config | JsonPrettyPrint}}</pre></dd>
 						{{end}}
 					</dl>
 				</div>