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