packages/logger/ctx_test.go
2025-06-12 18:05:05 +08:00

19 lines
432 B
Go

package logger
import (
"context"
"gitea.loveuer.com/yizhisec/packages/opt"
"testing"
)
func TestCtxLog(t *testing.T) {
DebugCtx(nil, "hello %s", "world")
InfoCtx(nil, "hello %s", "world")
WarnCtx(context.Background(), "hello %s", "world")
ctx := context.Background()
ctx = context.WithValue(ctx, opt.TraceKey, "value")
SetLogLevel(LogLevelDebug)
DebugCtx(ctx, "hello %s", "world")
ErrorCtx(ctx, "hello %s", "world")
}