add debug

This commit is contained in:
2023-06-13 23:18:54 +01:00
parent 8443b20949
commit ec53db45d5
9 changed files with 98 additions and 71 deletions

21
src/debug.go Normal file
View File

@@ -0,0 +1,21 @@
package main
import (
"fmt"
"os"
)
var debug = os.Getenv("__ARGON_DEBUG__") == "true"
func debugPrintln(a ...interface{}) {
if debug {
go func() {
defer func() {
if r := recover(); r != nil {
fmt.Println("debugPrintln: panic:", r)
}
}()
fmt.Println(a...)
}()
}
}