From 7f3e3a6034c5d1d5e652f20d951c4aa1156b11cb Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 4 Feb 2020 21:37:23 +0200 Subject: [PATCH] lib/logger: do not clutter `-loggerFormat=json` output with stack trace This should improve json parsing --- lib/logger/logger.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/logger/logger.go b/lib/logger/logger.go index 8763e6da4..403228016 100644 --- a/lib/logger/logger.go +++ b/lib/logger/logger.go @@ -155,6 +155,10 @@ func logMessage(level, msg string, skipframes int) { switch level { case "PANIC": + if *loggerFormat == "json" { + // Do not clutter `json` output with panic stack trace + os.Exit(-1) + } panic(errors.New(msg)) case "FATAL": os.Exit(-1)