2016-12-24 02:37:35 +01:00
|
|
|
package mssql
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
2019-06-30 05:28:17 +02:00
|
|
|
type Logger interface {
|
|
|
|
Printf(format string, v ...interface{})
|
|
|
|
Println(v ...interface{})
|
|
|
|
}
|
|
|
|
|
|
|
|
type optionalLogger struct {
|
|
|
|
logger Logger
|
|
|
|
}
|
2016-12-24 02:37:35 +01:00
|
|
|
|
2019-06-30 05:28:17 +02:00
|
|
|
func (o optionalLogger) Printf(format string, v ...interface{}) {
|
|
|
|
if o.logger != nil {
|
|
|
|
o.logger.Printf(format, v...)
|
2016-12-24 02:37:35 +01:00
|
|
|
} else {
|
|
|
|
log.Printf(format, v...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-30 05:28:17 +02:00
|
|
|
func (o optionalLogger) Println(v ...interface{}) {
|
|
|
|
if o.logger != nil {
|
|
|
|
o.logger.Println(v...)
|
2016-12-24 02:37:35 +01:00
|
|
|
} else {
|
|
|
|
log.Println(v...)
|
|
|
|
}
|
|
|
|
}
|