Disable logging by default, start logging onlu if DEBUG is set to 1
This commit is contained in:
parent
3c53798634
commit
802d6afc55
@ -67,7 +67,7 @@ func getUname() string {
|
|||||||
func Initialize() {
|
func Initialize() {
|
||||||
err := os.MkdirAll(LogDirectory, 0750)
|
err := os.MkdirAll(LogDirectory, 0750)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
RecoverPrettyPanic = false
|
RecoverPrettyPanic = true
|
||||||
DeadlockDetection = false
|
DeadlockDetection = false
|
||||||
WriteLogs = false
|
WriteLogs = false
|
||||||
return
|
return
|
||||||
|
5
main.go
5
main.go
@ -63,13 +63,10 @@ func main() {
|
|||||||
debug.LogDirectory = debugDir
|
debug.LogDirectory = debugDir
|
||||||
}
|
}
|
||||||
debugLevel := strings.ToLower(os.Getenv("DEBUG"))
|
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" {
|
if debugLevel == "1" || debugLevel == "t" || debugLevel == "true" {
|
||||||
debug.RecoverPrettyPanic = false
|
debug.RecoverPrettyPanic = false
|
||||||
debug.DeadlockDetection = true
|
debug.DeadlockDetection = true
|
||||||
|
debug.WriteLogs = true
|
||||||
}
|
}
|
||||||
debug.Initialize()
|
debug.Initialize()
|
||||||
defer debug.Recover()
|
defer debug.Recover()
|
||||||
|
Loading…
Reference in New Issue
Block a user