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