set default InfoLogger DebugLogger to io.Discard

As applications want select for themselves what gets written to
stderr or stdout. Particularly when it gets passed through to parent
processes that aren't just writing it to a log file.
This commit is contained in:
DanConwayDev
2025-07-23 14:56:47 +01:00
committed by fiatjaf_
parent 0a7f44307d
commit fa0db40822

6
log.go
View File

@@ -2,13 +2,13 @@ package nostr
import (
"log"
"os"
"io"
)
var (
// call SetOutput on InfoLogger to enable info logging
InfoLogger = log.New(os.Stderr, "[go-nostr][info] ", log.LstdFlags)
InfoLogger = log.New(io.Discard, "[go-nostr][info] ", log.LstdFlags)
// call SetOutput on DebugLogger to enable debug logging
DebugLogger = log.New(os.Stderr, "[go-nostr][debug] ", log.LstdFlags)
DebugLogger = log.New(io.Discard, "[go-nostr][debug] ", log.LstdFlags)
)