Преглед на файлове

Merge branch 'next' into fix-output-streaming

James Read преди 8 месеца
родител
ревизия
f25b456c3d
променени са 1 файла, в които са добавени 10 реда и са изтрити 4 реда
  1. 10 4
      service/main.go

+ 10 - 4
service/main.go

@@ -51,10 +51,16 @@ func init() {
 }
 }
 
 
 func initLog() {
 func initLog() {
-	log.SetFormatter(&log.TextFormatter{
-		ForceQuote:       true,
-		DisableTimestamp: true,
-	})
+	logFormat := os.Getenv("OLIVETIN_LOG_FORMAT")
+
+	if logFormat == "json" {
+		log.SetFormatter(&log.JSONFormatter{})
+	} else {
+		log.SetFormatter(&log.TextFormatter{
+			ForceQuote:       true,
+			DisableTimestamp: true,
+		})
+	}
 
 
 	// Use debug this early on to catch details about startup errors. The
 	// Use debug this early on to catch details about startup errors. The
 	// default config will raise the log level later, if not set.
 	// default config will raise the log level later, if not set.