micro/util/log/log.go

42 lines
746 B
Go
Raw Normal View History

2019-05-31 02:35:04 +03:00
// Package log is a global internal logger
package log
import (
"os"
"github.com/go-log/log"
golog "github.com/go-log/log/log"
)
var (
// the local logger
logger log.Logger = golog.New()
)
// Log makes use of github.com/go-log/log.Log
func Log(v ...interface{}) {
logger.Log(v...)
}
// Logf makes use of github.com/go-log/log.Logf
func Logf(format string, v ...interface{}) {
logger.Logf(format, v...)
}
// Fatal logs with Log and then exits with os.Exit(1)
func Fatal(v ...interface{}) {
Log(v...)
os.Exit(1)
}
// Fatalf logs with Logf and then exits with os.Exit(1)
func Fatalf(format string, v ...interface{}) {
Logf(format, v...)
os.Exit(1)
}
// SetLogger sets the local logger
func SetLogger(l log.Logger) {
logger = l
}