2022-09-10 08:02:57 +00:00
|
|
|
package logging
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PrintfLogger is a logger that implements a common Printf logger.
|
|
|
|
type PrintfLogger struct {
|
|
|
|
level logrus.Level
|
|
|
|
logrus *logrus.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
// Printf is the implementation of the interface.
|
2023-04-15 12:35:44 +00:00
|
|
|
func (l *PrintfLogger) Printf(format string, args ...any) {
|
2022-09-10 08:02:57 +00:00
|
|
|
l.logrus.Logf(l.level, format, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// CtxPrintfLogger is a logger that implements a common Printf logger with a ctx.
|
|
|
|
type CtxPrintfLogger struct {
|
|
|
|
level logrus.Level
|
|
|
|
logrus *logrus.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
// Printf is the implementation of the interface.
|
2023-04-15 12:35:44 +00:00
|
|
|
func (l *CtxPrintfLogger) Printf(_ context.Context, format string, args ...any) {
|
2022-09-10 08:02:57 +00:00
|
|
|
l.logrus.Logf(l.level, format, args...)
|
|
|
|
}
|