Example #1
0
func init() {
	// 全局日志前缀
	stdlog.SetPrefix(func() string {
		t := time.Now()
		return fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d] ", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())
	})
}
Example #2
0
func init() {
	runtime.GOMAXPROCS(4)
	pools = make(map[string]*redis.Pool)
	buffer = make(chan *Command, 100*10000) // 最大缓存100w

	for _, cmd := range strings.Split(syncCmdlist, ",") {
		needSync[cmd] = true
	}
	for _, cmd := range strings.Split(ignoreCmdList, ",") {
		ignoreSync[cmd] = true
	}

	stdlog.SetPrefix(func() string {
		t := time.Now()
		return fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d] ", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())
	})
}