1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 09:19:54 +00:00
Files
whiskr/debug.go
2025-08-29 22:55:41 +02:00

32 lines
398 B
Go

package main
import (
"encoding/json"
"os"
)
func dump(name string, val any) {
if !env.Debug {
return
}
b, _ := json.MarshalIndent(val, "", "\t")
os.WriteFile(name, b, 0644)
}
func debug(format string, args ...any) {
if !env.Debug {
return
}
log.Printf(format+"\n", args...)
}
func debugIf(cond bool, format string, args ...any) {
if !cond {
return
}
debug(format, args)
}