@@ -32,7 +32,7 @@ type Opts struct {
3232 CallerSkipFrameCount int
3333
3434 // These fields will be printed with every log.
35- DefaultFields []any
35+ DefaultFields []interface {}
3636}
3737
3838// Logger is the interface for all log operations
@@ -158,35 +158,35 @@ func LevelFromString(lvl string) (Level, error) {
158158}
159159
160160// Debug emits a debug log line.
161- func (l Logger ) Debug (msg string , fields ... any ) {
161+ func (l Logger ) Debug (msg string , fields ... interface {} ) {
162162 l .handleLog (msg , DebugLevel , fields ... )
163163}
164164
165165// Info emits a info log line.
166- func (l Logger ) Info (msg string , fields ... any ) {
166+ func (l Logger ) Info (msg string , fields ... interface {} ) {
167167 l .handleLog (msg , InfoLevel , fields ... )
168168}
169169
170170// Warn emits a warning log line.
171- func (l Logger ) Warn (msg string , fields ... any ) {
171+ func (l Logger ) Warn (msg string , fields ... interface {} ) {
172172 l .handleLog (msg , WarnLevel , fields ... )
173173}
174174
175175// Error emits an error log line.
176- func (l Logger ) Error (msg string , fields ... any ) {
176+ func (l Logger ) Error (msg string , fields ... interface {} ) {
177177 l .handleLog (msg , ErrorLevel , fields ... )
178178}
179179
180180// Fatal emits a fatal level log line.
181181// It aborts the current program with an exit code of 1.
182- func (l Logger ) Fatal (msg string , fields ... any ) {
182+ func (l Logger ) Fatal (msg string , fields ... interface {} ) {
183183 l .handleLog (msg , FatalLevel , fields ... )
184184 exit ()
185185}
186186
187187// handleLog emits the log after filtering log level
188188// and applying formatting of the fields.
189- func (l Logger ) handleLog (msg string , lvl Level , fields ... any ) {
189+ func (l Logger ) handleLog (msg string , lvl Level , fields ... interface {} ) {
190190 // Discard the log if the verbosity is higher.
191191 // For eg, if the lvl is `3` (error), but the incoming message is `0` (debug), skip it.
192192 if lvl < l .Opts .Level {
@@ -210,7 +210,7 @@ func (l Logger) handleLog(msg string, lvl Level, fields ...any) {
210210 count int // to find out if this is the last key in while itering fields.
211211 fieldCount = len (l .DefaultFields ) + len (fields )
212212 key string
213- val any
213+ val interface {}
214214 )
215215
216216 // If there are odd number of fields, ignore the last.
@@ -310,7 +310,7 @@ func writeCallerToBuf(buf *byteBuffer, key string, depth int, lvl Level, color,
310310}
311311
312312// writeToBuf takes key, value and additional options to write to the buffer in logfmt.
313- func writeToBuf (buf * byteBuffer , key string , val any , lvl Level , color , space bool ) {
313+ func writeToBuf (buf * byteBuffer , key string , val interface {} , lvl Level , color , space bool ) {
314314 if color {
315315 escapeAndWriteString (buf , getColoredKey (key , lvl ))
316316 } else {
@@ -354,7 +354,7 @@ func writeToBuf(buf *byteBuffer, key string, val any, lvl Level, color, space bo
354354 }
355355}
356356
357- // escapeAndWriteString escapes the string if any unwanted chars are there.
357+ // escapeAndWriteString escapes the string if interface{} unwanted chars are there.
358358func escapeAndWriteString (buf * byteBuffer , s string ) {
359359 idx := strings .IndexFunc (s , checkEscapingRune )
360360 if idx != - 1 || s == "null" {
0 commit comments