core/config: remove debug option, always use json logs (#4857)

* core/config: remove debug option, always use json logs

* go mod tidy
This commit is contained in:
Caleb Doxsey 2023-12-15 11:29:05 -07:00 committed by GitHub
parent ddc9d957ba
commit d6221c07ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 632 additions and 665 deletions

View file

@ -4,15 +4,20 @@ import (
"testing"
"github.com/rs/zerolog"
"github.com/pomerium/pomerium/internal/log"
"github.com/rs/zerolog/log"
)
// SetLogger sets the given logger as the global logger for the remainder of
// the current test. Because the logger is global, this must not be called from
// parallel tests.
func SetLogger(t *testing.T, logger *zerolog.Logger) {
originalLogger := log.Logger()
t.Cleanup(func() { log.SetLogger(originalLogger) })
log.SetLogger(logger)
func SetLogger(t *testing.T, logger zerolog.Logger) {
t.Helper()
originalLogger := log.Logger
t.Cleanup(func() { log.Logger = originalLogger })
log.Logger = logger
originalContextLogger := zerolog.DefaultContextLogger
t.Cleanup(func() { zerolog.DefaultContextLogger = originalContextLogger })
zerolog.DefaultContextLogger = &logger
}