open-vault/vendor/github.com/denisenkom/go-mssqldb/log.go

31 lines
473 B
Go
Raw Normal View History

2016-03-03 15:16:59 +00:00
package mssql
import (
"log"
)
2017-01-04 21:47:38 +00:00
type Logger interface {
Printf(format string, v ...interface{})
Println(v ...interface{})
}
type optionalLogger struct {
logger Logger
}
2016-03-03 15:16:59 +00:00
2017-01-04 21:47:38 +00:00
func (o optionalLogger) Printf(format string, v ...interface{}) {
if o.logger != nil {
o.logger.Printf(format, v...)
2016-03-03 15:16:59 +00:00
} else {
log.Printf(format, v...)
}
}
2017-01-04 21:47:38 +00:00
func (o optionalLogger) Println(v ...interface{}) {
if o.logger != nil {
o.logger.Println(v...)
2016-03-03 15:16:59 +00:00
} else {
log.Println(v...)
}
}