コード例 #1
0
ファイル: log.go プロジェクト: huangjiehua/tendermint
func init() {
	log.SetHandler(
		log15.LvlFilterHandler(
			log15.LvlWarn,
			//log15.LvlDebug,
			logger.RootHandler(),
		),
	)
}
コード例 #2
0
ファイル: log.go プロジェクト: huangjiehua/tendermint
// You might want to call this after resetting tendermint/config.
func Reset() {

	var logLevel string = "debug"
	if config != nil {
		logLevel = config.GetString("log_level")
	}

	// stdout handler
	//handlers := []log15.Handler{}
	stdoutHandler := log15.LvlFilterHandler(
		getLevel(logLevel),
		log15.StreamHandler(os.Stdout, log15.TerminalFormat()),
	)
	//handlers = append(handlers, stdoutHandler)

	// Set rootHandler.
	//rootHandler = log15.MultiHandler(handlers...)
	rootHandler = stdoutHandler

	// By setting handlers on the root, we handle events from all loggers.
	log15.Root().SetHandler(rootHandler)
}