mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 18:24:14 +01:00
25 lines
422 B
Go
25 lines
422 B
Go
|
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{}) {
|
||
|
_ = l.log.Output(2, fmt.Sprintf(format, v...))
|
||
|
}
|
||
|
|
||
|
var Logger Logging = &logger{
|
||
|
log: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile),
|
||
|
}
|