mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-28 03:27:15 +02:00
Tests were dumping megabytes of zerolog output on failure; silence at init and let individual tests opt in via SetGlobalLevel when they need log-driven assertions. Updates #3157
19 lines
732 B
Go
19 lines
732 B
Go
package zlog
|
|
|
|
import "github.com/rs/zerolog"
|
|
|
|
// init pins zerolog to TraceLevel for the zlog test binary.
|
|
//
|
|
// zlog's tests use zerolog.New(&buf) and assert on Info-level output. zerolog's
|
|
// (*Logger).should() gates emission on the global level, so any global level
|
|
// above Info would silently break the assertions.
|
|
//
|
|
// Today zlog does not transitively import hscontrol/types, so the test
|
|
// silencing init() in hscontrol/types/testlog.go does not run in this binary.
|
|
// This init defends against that changing in the future: if a future import
|
|
// chain pulls in hscontrol/types, this file will still ensure trace-level
|
|
// output is available for zlog's assertions.
|
|
func init() {
|
|
zerolog.SetGlobalLevel(zerolog.TraceLevel)
|
|
}
|