Skip to content

Commit

Permalink
fix logger vararg bug (#139)
Browse files Browse the repository at this point in the history
Co-authored-by: Pure White <[email protected]>
  • Loading branch information
Andello and PureWhiteWu authored Aug 17, 2022
1 parent 4820298 commit b879a72
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions util/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,108 +126,108 @@ func Trace(v ...interface{}) {

// Fatalf calls the default logger's Fatalf method and then os.Exit(1).
func Fatalf(format string, v ...interface{}) {
defaultLogger.Fatalf(format, v)
defaultLogger.Fatalf(format, v...)
}

// Errorf calls the default logger's Errorf method.
func Errorf(format string, v ...interface{}) {
if level > LevelError {
return
}
defaultLogger.Errorf(format, v)
defaultLogger.Errorf(format, v...)
}

// Warnf calls the default logger's Warnf method.
func Warnf(format string, v ...interface{}) {
if level > LevelWarn {
return
}
defaultLogger.Warnf(format, v)
defaultLogger.Warnf(format, v...)
}

// Noticef calls the default logger's Noticef method.
func Noticef(format string, v ...interface{}) {
if level > LevelNotice {
return
}
defaultLogger.Noticef(format, v)
defaultLogger.Noticef(format, v...)
}

// Infof calls the default logger's Infof method.
func Infof(format string, v ...interface{}) {
if level > LevelInfo {
return
}
defaultLogger.Infof(format, v)
defaultLogger.Infof(format, v...)
}

// Debugf calls the default logger's Debugf method.
func Debugf(format string, v ...interface{}) {
if level > LevelDebug {
return
}
defaultLogger.Debugf(format, v)
defaultLogger.Debugf(format, v...)
}

// Tracef calls the default logger's Tracef method.
func Tracef(format string, v ...interface{}) {
if level > LevelTrace {
return
}
defaultLogger.Tracef(format, v)
defaultLogger.Tracef(format, v...)
}

// CtxFatalf calls the default logger's CtxFatalf method and then os.Exit(1).
func CtxFatalf(ctx context.Context, format string, v ...interface{}) {
defaultLogger.CtxFatalf(ctx, format, v)
defaultLogger.CtxFatalf(ctx, format, v...)
}

// CtxErrorf calls the default logger's CtxErrorf method.
func CtxErrorf(ctx context.Context, format string, v ...interface{}) {
if level > LevelError {
return
}
defaultLogger.CtxErrorf(ctx, format, v)
defaultLogger.CtxErrorf(ctx, format, v...)
}

// CtxWarnf calls the default logger's CtxWarnf method.
func CtxWarnf(ctx context.Context, format string, v ...interface{}) {
if level > LevelWarn {
return
}
defaultLogger.CtxWarnf(ctx, format, v)
defaultLogger.CtxWarnf(ctx, format, v...)
}

// CtxNoticef calls the default logger's CtxNoticef method.
func CtxNoticef(ctx context.Context, format string, v ...interface{}) {
if level > LevelNotice {
return
}
defaultLogger.CtxNoticef(ctx, format, v)
defaultLogger.CtxNoticef(ctx, format, v...)
}

// CtxInfof calls the default logger's CtxInfof method.
func CtxInfof(ctx context.Context, format string, v ...interface{}) {
if level > LevelInfo {
return
}
defaultLogger.CtxInfof(ctx, format, v)
defaultLogger.CtxInfof(ctx, format, v...)
}

// CtxDebugf calls the default logger's CtxDebugf method.
func CtxDebugf(ctx context.Context, format string, v ...interface{}) {
if level > LevelDebug {
return
}
defaultLogger.CtxDebugf(ctx, format, v)
defaultLogger.CtxDebugf(ctx, format, v...)
}

// CtxTracef calls the default logger's CtxTracef method.
func CtxTracef(ctx context.Context, format string, v ...interface{}) {
if level > LevelTrace {
return
}
defaultLogger.CtxTracef(ctx, format, v)
defaultLogger.CtxTracef(ctx, format, v...)
}

var level Level
Expand Down

0 comments on commit b879a72

Please sign in to comment.