manual-en-US/chapter-05
Lunny Xiao 463f03717d
fix link
2019-11-27 21:05:29 +08:00
..
README.md fix link 2019-11-27 21:05:29 +08:00

Logger

Logger is an interface, default it will use https://gitea.com/lunny/log as log implement if you do not define your own log.

type Logger interface {
	Debugf(format string, v ...interface{})
	Debug(v ...interface{})
	Infof(format string, v ...interface{})
	Info(v ...interface{})
	Warnf(format string, v ...interface{})
	Warn(v ...interface{})
	Errorf(format string, v ...interface{})
	Error(v ...interface{})
}

You can custom your log

l := log.New(out, "[tango] ", log.Ldefault())
l.SetOutputLevel(log.Ldebug)
t := tango.Classic(l)
t.Run()

If you want to save log to file.

l := log.New(out, "[tango] ", log.Ldefault())
l.SetOutputLevel(log.Ldebug)
f, _ := os.Create("my.log")
l.SetOutput(f)
t := tango.Classic(l)
t.Run()