Revert "update slog usage"

This reverts commit 1ca9b48b67.
This commit is contained in:
Gavin Nishizawa 2023-12-05 15:21:35 -08:00
parent 1ca9b48b67
commit dfc3ef53d5
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -47,35 +47,32 @@ func WithTB(ctx context.Context, t testing.TB, opts *slogtest.Options) context.C
return With(ctx, l)
}
// see slog.Logger's Info; it is now possible to do the following
// log.Debug(ctx, msg, keyString1, valueAny1, slog.Field, keyString2, valueAny2, slog.Map)
// Warning: it will panic when using key, value as separate args if key is not a string or value arg is missing
func Debug(ctx context.Context, msg string, fields ...any) {
func Debug(ctx context.Context, msg string, fields ...slog.Field) {
slog.Helper()
from(ctx).Debug(ctx, msg, fields...)
}
func Info(ctx context.Context, msg string, fields ...any) {
func Info(ctx context.Context, msg string, fields ...slog.Field) {
slog.Helper()
from(ctx).Info(ctx, msg, fields...)
}
func Warn(ctx context.Context, msg string, fields ...any) {
func Warn(ctx context.Context, msg string, fields ...slog.Field) {
slog.Helper()
from(ctx).Warn(ctx, msg, fields...)
}
func Error(ctx context.Context, msg string, fields ...any) {
func Error(ctx context.Context, msg string, fields ...slog.Field) {
slog.Helper()
from(ctx).Error(ctx, msg, fields...)
}
func Critical(ctx context.Context, msg string, fields ...any) {
func Critical(ctx context.Context, msg string, fields ...slog.Field) {
slog.Helper()
from(ctx).Critical(ctx, msg, fields...)
}
func Fatal(ctx context.Context, msg string, fields ...any) {
func Fatal(ctx context.Context, msg string, fields ...slog.Field) {
slog.Helper()
from(ctx).Fatal(ctx, msg, fields...)
}