logger.go (501B)
1 package internal 2 3 import ( 4 "fmt" 5 "log" 6 "os" 7 ) 8 9 var Warn = log.New(os.Stderr, "WARN: bun: ", log.LstdFlags) 10 11 var Deprecated = log.New(os.Stderr, "DEPRECATED: bun: ", log.LstdFlags) 12 13 type Logging interface { 14 Printf(format string, v ...interface{}) 15 } 16 17 type logger struct { 18 log *log.Logger 19 } 20 21 func (l *logger) Printf(format string, v ...interface{}) { 22 _ = l.log.Output(2, fmt.Sprintf(format, v...)) 23 } 24 25 var Logger Logging = &logger{ 26 log: log.New(os.Stderr, "bun: ", log.LstdFlags|log.Lshortfile), 27 }