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