gorm/logger.go

32 lines
486 B
Go
Raw Normal View History

2013-11-11 05:05:14 +04:00
package gorm
import "fmt"
var logger interface{}
type Logger interface {
Print(v ...interface{})
}
func Print(level string, v ...interface{}) {
args := []interface{}{level}
if l, ok := logger.(Logger); ok {
l.Print(append(args, v...))
} else {
fmt.Println("logger haven't been set,", append(args, v...))
}
}
func warn(v ...interface{}) {
Print("warn", v...)
}
func info(v ...interface{}) {
Print("info", v...)
}
func debug(v ...interface{}) {
Print("debug", v...)
}