From 802d6afc551feb193d6bf2ced563756bc051bf2d Mon Sep 17 00:00:00 2001 From: Nilesh Patra Date: Thu, 6 Jul 2023 18:26:08 +0000 Subject: [PATCH] Disable logging by default, start logging onlu if DEBUG is set to 1 --- debug/debug.go | 2 +- main.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/debug/debug.go b/debug/debug.go index 4a0a1de..e62b078 100644 --- a/debug/debug.go +++ b/debug/debug.go @@ -67,7 +67,7 @@ func getUname() string { func Initialize() { err := os.MkdirAll(LogDirectory, 0750) if err != nil { - RecoverPrettyPanic = false + RecoverPrettyPanic = true DeadlockDetection = false WriteLogs = false return diff --git a/main.go b/main.go index 3083683..58401b5 100644 --- a/main.go +++ b/main.go @@ -63,13 +63,10 @@ func main() { debug.LogDirectory = debugDir } debugLevel := strings.ToLower(os.Getenv("DEBUG")) - if debugLevel != "0" && debugLevel != "f" && debugLevel != "false" { - debug.WriteLogs = true - debug.RecoverPrettyPanic = true - } if debugLevel == "1" || debugLevel == "t" || debugLevel == "true" { debug.RecoverPrettyPanic = false debug.DeadlockDetection = true + debug.WriteLogs = true } debug.Initialize() defer debug.Recover()