forked from ebhomengo/niki
1
0
Fork 0
niki/vendor/github.com/redis/go-redis/v9/internal/log.go

32 lines
527 B
Go
Raw Normal View History

2024-02-18 10:42:21 +00:00
package internal
import (
"context"
"fmt"
"log"
"os"
)
type Logging interface {
Printf(ctx context.Context, format string, v ...interface{})
}
type logger struct {
log *log.Logger
}
func (l *logger) Printf(ctx context.Context, format string, v ...interface{}) {
2024-02-18 10:42:21 +00:00
_ = l.log.Output(2, fmt.Sprintf(format, v...))
2024-02-18 10:42:21 +00:00
}
// Logger calls Output to print to the stderr.
2024-02-18 10:42:21 +00:00
// Arguments are handled in the manner of fmt.Print.
2024-02-18 10:42:21 +00:00
var Logger Logging = &logger{
2024-02-18 10:42:21 +00:00
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
}