func init() { //初始化日志 Logger = log4go.NewLogger() Logger.AddFilter("fine", log4go.FINE, log4go.NewConsoleLogWriter()) Logger.AddFilter("error", log4go.ERROR, log4go.NewFileLogWriter("error.log", false)) Logger.AddFilter("info", log4go.INFO, log4go.NewFileLogWriter("info.log", false)) Logger.Info("log inited") }
func main() { log := l4g.NewLogger() log.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter()) log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02")) }