File: log.go

package info (click to toggle)
golang-github-denisenkom-go-mssqldb 0.0~git20170717.0.8fccfc8-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 3,240 kB
  • sloc: makefile: 5
file content (30 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (3)
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...)
	}
}