Disable logging by default, start logging onlu if DEBUG is set to 1

This commit is contained in:
Nilesh Patra 2023-07-06 18:26:08 +00:00
parent 3c53798634
commit 802d6afc55
2 changed files with 2 additions and 5 deletions

View File

@ -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

View File

@ -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()