2019-04-10 00:35:44 +00:00
|
|
|
package log
|
|
|
|
|
2019-06-28 03:24:13 +00:00
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"github.com/kirsle/golog"
|
|
|
|
)
|
2019-04-10 00:35:44 +00:00
|
|
|
|
|
|
|
// Logger is the public golog.Logger object.
|
|
|
|
var Logger *golog.Logger
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
Logger = golog.GetLogger("doodle")
|
|
|
|
Logger.Configure(&golog.Config{
|
2019-04-16 06:07:15 +00:00
|
|
|
Level: golog.InfoLevel,
|
2019-04-10 00:35:44 +00:00
|
|
|
Theme: golog.DarkTheme,
|
|
|
|
Colors: golog.ExtendedColor,
|
|
|
|
TimeFormat: "2006-01-02 15:04:05.000000",
|
|
|
|
})
|
2019-06-28 03:24:13 +00:00
|
|
|
|
|
|
|
// TODO: Disable ANSI colors in logs on Windows.
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
Logger.Config.Colors = golog.NoColor
|
|
|
|
}
|
2019-04-10 00:35:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Debug logger function.
|
|
|
|
func Debug(msg string, v ...interface{}) {
|
|
|
|
Logger.Debug(msg, v...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Info logger function.
|
|
|
|
func Info(msg string, v ...interface{}) {
|
|
|
|
Logger.Info(msg, v...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Warn logger function.
|
|
|
|
func Warn(msg string, v ...interface{}) {
|
|
|
|
Logger.Warn(msg, v...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error logger function.
|
|
|
|
func Error(msg string, v ...interface{}) {
|
|
|
|
Logger.Error(msg, v...)
|
|
|
|
}
|