1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-10 04:17:59 +02:00
authboss/logger_test.go

36 lines
664 B
Go
Raw Normal View History

package authboss
import (
"context"
"testing"
)
type (
testLogger struct{}
testCtxLogger struct{}
)
func (t testLogger) Info(string) {}
func (t testLogger) Error(string) {}
func (t testLogger) FromContext(ctx context.Context) Logger { return testCtxLogger{} }
func (t testCtxLogger) Info(string) {}
func (t testCtxLogger) Error(string) {}
func TestLogger(t *testing.T) {
t.Parallel()
ab := New()
logger := testLogger{}
ab.Config.Core.Logger = logger
if logger != ab.Logger(nil).(testLogger) {
t.Error("wanted our logger back")
}
if _, ok := ab.Logger(context.Background()).(testCtxLogger); !ok {
t.Error("wanted ctx logger back")
}
}