Example #1
0
func TestLog4Go1() {

	l4g.Error("..RRR.")
	l4g.Warn("...")
	log := l4g.NewLogger()
	defer log.Close()
	log.AddFilter("stdout", l4g.WARNING, l4g.NewConsoleLogWriter())
	log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
}
Example #2
0
func SetLog() (logger *log4go.Logger) {
	w := log4go.NewFileWriter()
	w.SetPathPattern("/tmp/logs/error%Y%M%D%H.log")

	logger = log4go.NewLogger()
	logger.Register(w)
	logger.SetLevel(log4go.ERROR)
	return
}