Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,20 @@ func isPrivateOrLoopback(ip net.IP) bool {
}

func main() {
// Minimum severity for wuzapi's own logs, from LOG_LEVEL (trace, debug,
// info, warn, error, fatal, panic). Without it zerolog stays at its
// TraceLevel default, so every Debug and Info line is emitted with no way
// to turn it down — -wadebug governs the whatsmeow logger, not this one.
// An absent or unrecognized value keeps the previous behaviour, so a typo
// can never silence the service.
//
// Set first thing in main: the level is consulted per record rather than
// baked into the logger, so setting it here also covers the config lines
// logged before the logger below is installed.
if lvl, err := zerolog.ParseLevel(strings.ToLower(strings.TrimSpace(os.Getenv("LOG_LEVEL")))); err == nil && lvl != zerolog.NoLevel {
zerolog.SetGlobalLevel(lvl)
}

for _, cidr := range []string{
"127.0.0.0/8", // IPv4 loopback
"10.0.0.0/8", // RFC1918
Expand Down