mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-19 06:12:44 +01:00
25 lines
383 B
Go
25 lines
383 B
Go
|
//go:build debug
|
||
|
|
||
|
package nostr
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
func debugLog(str string, args ...any) {
|
||
|
for i, v := range args {
|
||
|
switch v.(type) {
|
||
|
case []json.RawMessage:
|
||
|
j, _ := json.Marshal(v)
|
||
|
args[i] = string(j)
|
||
|
case []byte:
|
||
|
args[i] = string(v.([]byte))
|
||
|
case fmt.Stringer:
|
||
|
args[i] = v.(fmt.Stringer).String()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
DebugLogger.Printf(str, args...)
|
||
|
}
|