2016-12-23 18:37:35 -07:00
|
|
|
package mssql
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
2019-06-29 21:28:17 -06:00
|
|
|
type Logger interface {
|
|
|
|
Printf(format string, v ...interface{})
|
|
|
|
Println(v ...interface{})
|
|
|
|
}
|
|
|
|
|
|
|
|
type optionalLogger struct {
|
|
|
|
logger Logger
|
|
|
|
}
|
2016-12-23 18:37:35 -07:00
|
|
|
|
2019-06-29 21:28:17 -06:00
|
|
|
func (o optionalLogger) Printf(format string, v ...interface{}) {
|
|
|
|
if o.logger != nil {
|
|
|
|
o.logger.Printf(format, v...)
|
2016-12-23 18:37:35 -07:00
|
|
|
} else {
|
|
|
|
log.Printf(format, v...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-29 21:28:17 -06:00
|
|
|
func (o optionalLogger) Println(v ...interface{}) {
|
|
|
|
if o.logger != nil {
|
|
|
|
o.logger.Println(v...)
|
2016-12-23 18:37:35 -07:00
|
|
|
} else {
|
|
|
|
log.Println(v...)
|
|
|
|
}
|
|
|
|
}
|