PrintfLevel returns a logger that uses given printf-style function to print log output for logs of a given level or above.
(printf func(msg string, args ...any), prefix string, level zapcore.Level)
| 17 | |
| 18 | // PrintfLevel returns a logger that uses given printf-style function to print log output for logs of a given level or above. |
| 19 | func PrintfLevel(printf func(msg string, args ...any), prefix string, level zapcore.Level) *zap.SugaredLogger { |
| 20 | writer := printfWriter{printf, prefix} |
| 21 | |
| 22 | return zap.New( |
| 23 | zapcore.NewCore( |
| 24 | zaplogutil.NewStdConsoleEncoder(zaplogutil.StdConsoleEncoderConfig{}), |
| 25 | writer, |
| 26 | level, |
| 27 | ), |
| 28 | ).Sugar() |
| 29 | } |
| 30 | |
| 31 | // PrintfFactory returns LoggerForModuleFunc that uses given printf-style function to print log output. |
| 32 | func PrintfFactory(printf func(msg string, args ...any)) logging.LoggerFactory { |
no test coverage detected