1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00
go-micro/util/log/log.go
2019-05-31 00:35:04 +01:00

42 lines
746 B
Go

// 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
}