Log config pretty printer (#1097)

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>
This commit is contained in:
Jonas authored and Lunny Xiao committed 2017-03-02 08:25:44 +08:00
1 parent 0380ce269f
commit f3bf409082
2 files changed
+10 -1

No files matched your search

+9
View File
@@ -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()
},
}}
}