@@ -101,21 +101,33 @@ type SlogLoggerf struct {
101101
102102// Debugf implements Debugf method for LogfProvider interface
103103func (s * SlogLoggerf ) Debugf (ctx context.Context , format string , v ... any ) {
104+ if ! s .Logger .Enabled (ctx , slog .LevelDebug ) {
105+ return
106+ }
104107 s .Logger .DebugContext (ctx , fmt .Sprintf (format , v ... ))
105108}
106109
107110// Infof implements Infof method for LogfProvider interface
108111func (s SlogLoggerf ) Infof (ctx context.Context , format string , v ... any ) {
112+ if ! s .Logger .Enabled (ctx , slog .LevelInfo ) {
113+ return
114+ }
109115 s .Logger .InfoContext (ctx , fmt .Sprintf (format , v ... ))
110116}
111117
112118// Warnf implements Warnf method for LogfProvider interface
113119func (s SlogLoggerf ) Warnf (ctx context.Context , format string , v ... any ) {
120+ if ! s .Logger .Enabled (ctx , slog .LevelWarn ) {
121+ return
122+ }
114123 s .Logger .WarnContext (ctx , fmt .Sprintf (format , v ... ))
115124}
116125
117126// Errorf implements Errorf method for LogfProvider interface
118127func (s SlogLoggerf ) Errorf (ctx context.Context , format string , v ... any ) {
128+ if ! s .Logger .Enabled (ctx , slog .LevelError ) {
129+ return
130+ }
119131 s .Logger .ErrorContext (ctx , fmt .Sprintf (format , v ... ))
120132}
121133
0 commit comments