summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/denisenkom/go-mssqldb/log.go
blob: 9b8c551e88d9270a8329ed70a2bf6e19180b8630 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package mssql

import (
	"log"
)

type Logger interface {
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

type optionalLogger struct {
	logger Logger
}

func (o optionalLogger) Printf(format string, v ...interface{}) {
	if o.logger != nil {
		o.logger.Printf(format, v...)
	} else {
		log.Printf(format, v...)
	}
}

func (o optionalLogger) Println(v ...interface{}) {
	if o.logger != nil {
		o.logger.Println(v...)
	} else {
		log.Println(v...)
	}
}