Open xuyang2 opened 1 year ago
I think this can be fixed by a little copying: ( And checking with canLogAt() before fmt.Sprintf() can also improve performance )
func (l *Logger) Info(args ...interface{}) {
if !l.canLogAt(InfoLevel) {
return
}
l.base.Info(args...)
}
func (l *Logger) Infof(format string, args ...interface{}) {
if !l.canLogAt(InfoLevel) {
return
}
l.base.Info(fmt.Sprintf(format, args...))
// l.Info(fmt.Sprintf(format, args...))
}
The call stack depth of Infof() and Info() should be the same,otherwise the logger cannot use the same
callerSkip
number to get the file and line number of the code that calls the logger.Step to produce: wrap a zap.Logger,pass it to asynq.NewScheduler(), start the Scheduler
expected output:
actual output:
Cause: Logger.Infof() calls Logger.Info() https://github.com/hibiken/asynq/blob/123d560a4488fad0998a90f46cada46e3849b20d/scheduler.go#L223C17-L224