...
1
2
3
4
5
6
7 package slog
8
9 import (
10 "context"
11 "log"
12 "log/slog"
13 )
14
15
16 func Default() *Logger { return slog.Default() }
17
18
19
20
21 func SetDefault(l *Logger) {
22 slog.SetDefault(l)
23 }
24
25
26
27
28
29
30
31 type Logger = slog.Logger
32
33
34 func New(h Handler) *Logger {
35 return slog.New(h)
36 }
37
38
39 func With(args ...any) *Logger {
40 return slog.With(args...)
41 }
42
43
44
45
46 func NewLogLogger(h Handler, level Level) *log.Logger {
47 return slog.NewLogLogger(h, level)
48 }
49
50
51 func Debug(msg string, args ...any) {
52 slog.Debug(msg, args...)
53 }
54
55
56 func DebugContext(ctx context.Context, msg string, args ...any) {
57 slog.DebugContext(ctx, msg, args...)
58 }
59
60
61 func Info(msg string, args ...any) {
62 slog.Info(msg, args...)
63 }
64
65
66 func InfoContext(ctx context.Context, msg string, args ...any) {
67 slog.InfoContext(ctx, msg, args...)
68 }
69
70
71 func Warn(msg string, args ...any) {
72 slog.Warn(msg, args...)
73 }
74
75
76 func WarnContext(ctx context.Context, msg string, args ...any) {
77 slog.WarnContext(ctx, msg, args...)
78 }
79
80
81 func Error(msg string, args ...any) {
82 slog.Error(msg, args...)
83 }
84
85
86 func ErrorContext(ctx context.Context, msg string, args ...any) {
87 slog.ErrorContext(ctx, msg, args...)
88 }
89
90
91 func Log(ctx context.Context, level Level, msg string, args ...any) {
92 slog.Log(ctx, level, msg, args...)
93 }
94
95
96 func LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
97 slog.LogAttrs(ctx, level, msg, attrs...)
98 }
99
View as plain text