json or text

This commit is contained in:
callebtc
2022-08-03 18:25:02 +02:00
parent d9dc022cd3
commit cd49617fe6
3 changed files with 64 additions and 20 deletions

View File

@@ -27,7 +27,10 @@ func welcome() {
// setLogger will initialize the log format
func setLogger(debug bool, json bool) {
if json {
log.SetFormatter(&log.JSONFormatter{})
customFormatter := new(log.JSONFormatter)
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
customFormatter.PrettyPrint = true
log.SetFormatter(customFormatter)
return
}