Example #1
0
func main() {
	alog.RegisterAlog("config.yaml")
	alog.SetLogTag("Sample")
	alog.Debug("Debug info...")
	alog.DebugC("Debug console info...")
	alog.Info("Info info...")
	alog.InfoC("Info console info...")
	alog.Warn("Warn info...")
	alog.WarnC("Warn console info...")
	alog.Error("Error info...")
	alog.ErrorC("Error console info...")
	alog.Fatal("Fatal info...")
	alog.FatalC("Fatal console info...")
	time.Sleep(2 * time.Second)
}
Example #2
0
func main() {
	_GCHComplete = make(chan time.Time, 1)
	startTime := time.Now()
	alog.RegisterAlog("config.yaml")
	alog.GALog.SetLogTag("REDIS")
	ticker := time.NewTicker(time.Second)
	go output(startTime, ticker)
	go func() {
		logInfo := logData()
		for i := 0; i < _LogNum; i++ {
			alog.Info(logInfo)
		}
	}()
	endTime := <-_GCHComplete
	useSecond := float64(endTime.Sub(startTime))/float64(time.Second) - 1
	fmt.Printf("\n===> 文件日志写入\n===> 总条数:%d,总耗时:%.2fs,每条日志长度:%d,每秒写入日志条数:%d\n",
		_LogNum, useSecond, _DataLen, int64(_LogNum)/int64(useSecond))
}