You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// WithLogger both set dcron and cron logger.
func WithLogger(logger interface{ Printf(string, ...interface{}) }) Option {
return func(dcron *Dcron) {
//set dcron logger
dcron.logger = logger
//set cron logger,这里设置的是标准日志输出,很多信息无法打印
f := cron.WithLogger(cron.PrintfLogger(logger))
dcron.crOptions = append(dcron.crOptions, f)
}
}
// PrintfLogger wraps a Printf-based logger (such as the standard library "log")
// into an implementation of the Logger interface which logs errors only.
func PrintfLogger(l interface{ Printf(string, ...interface{}) }) Logger {
return printfLogger{l, false}
}
// VerbosePrintfLogger wraps a Printf-based logger (such as the standard library
// "log") into an implementation of the Logger interface which logs everything.
func VerbosePrintfLogger(l interface{ Printf(string, ...interface{}) }) Logger {
return printfLogger{l, true}
}
问题说明:
当设置的标准日志输出,在addFunc中的func想要日志输出,实际上并没有输出日志。设置WithPrintLogInfo只是打印了dcron的日志,cron的日志还是无法打印。
问题原因:
默认设置日志格式的时候
建议设置dcron.loginfo设置为true的时候,则cron改成,f := cron.VerbosePrintfLogger(cron.PrintfLogger(logger)) ?
The text was updated successfully, but these errors were encountered: