mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-09 19:31:21 +01:00
30 lines
473 B
Go
30 lines
473 B
Go
package mssql
|
|
|
|
import (
|
|
"log"
|
|
)
|
|
|
|
type Logger interface {
|
|
Printf(format string, v ...interface{})
|
|
Println(v ...interface{})
|
|
}
|
|
|
|
type optionalLogger struct {
|
|
logger Logger
|
|
}
|
|
|
|
func (o optionalLogger) Printf(format string, v ...interface{}) {
|
|
if o.logger != nil {
|
|
o.logger.Printf(format, v...)
|
|
} else {
|
|
log.Printf(format, v...)
|
|
}
|
|
}
|
|
|
|
func (o optionalLogger) Println(v ...interface{}) {
|
|
if o.logger != nil {
|
|
o.logger.Println(v...)
|
|
} else {
|
|
log.Println(v...)
|
|
}
|
|
}
|