logutil: add Trace and TraceContext helpers (#12110)

This commit is contained in:
Michael Yang
2025-09-02 13:09:12 -07:00
committed by GitHub
parent 8149a3c86e
commit fb92b61754
7 changed files with 22 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
package logutil
import (
"context"
"io"
"log/slog"
"path/filepath"
@@ -27,3 +28,11 @@ func NewLogger(w io.Writer, level slog.Level) *slog.Logger {
},
}))
}
func Trace(msg string, args ...any) {
slog.Log(context.TODO(), LevelTrace, msg, args...)
}
func TraceContext(ctx context.Context, msg string, args ...any) {
slog.Log(ctx, LevelTrace, msg, args...)
}