k3s/vendor/github.com/emicklei/go-restful/log/log.go

35 lines
688 B
Go
Raw Normal View History

package log
import (
stdlog "log"
"os"
)
2017-04-21 21:56:01 +00:00
// StdLogger corresponds to a minimal subset of the interface satisfied by stdlib log.Logger
type StdLogger interface {
Print(v ...interface{})
Printf(format string, v ...interface{})
}
var Logger StdLogger
func init() {
// default Logger
2015-11-30 22:39:57 +00:00
SetLogger(stdlog.New(os.Stderr, "[restful] ", stdlog.LstdFlags|stdlog.Lshortfile))
}
2017-04-21 21:56:01 +00:00
// SetLogger sets the logger for this package
func SetLogger(customLogger StdLogger) {
Logger = customLogger
}
2017-04-21 21:56:01 +00:00
// Print delegates to the Logger
func Print(v ...interface{}) {
Logger.Print(v...)
}
2017-04-21 21:56:01 +00:00
// Printf delegates to the Logger
func Printf(format string, v ...interface{}) {
Logger.Printf(format, v...)
}