示例#1
0
文件: log.go 项目: zramsay/geth-tmsp
// You might want to call this after resetting tendermint/go-config.
func Reset() {

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

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

	// bypass handler for not filtering on global logLevel.
	bypassHandler = log15.StreamHandler(os.Stdout, log15.TerminalFormat())
	//handlers = append(handlers, bypassHandler)

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

	// By setting handlers on the root, we handle events from all loggers.
	log15.Root().SetHandler(mainHandler)
}
示例#2
0
func resetWithLogLevel(logLevel string) {
	// main handler
	//handlers := []log15.Handler{}
	mainHandler = log15.LvlFilterHandler(
		getLevel(logLevel),
		log15.StreamHandler(os.Stdout, log15.TerminalFormat()),
	)
	//handlers = append(handlers, mainHandler)

	// bypass handler for not filtering on global logLevel.
	bypassHandler = log15.StreamHandler(os.Stdout, log15.TerminalFormat())
	//handlers = append(handlers, bypassHandler)

	// By setting handlers on the root, we handle events from all loggers.
	log15.Root().SetHandler(mainHandler)
}
示例#3
0
文件: log.go 项目: jaekwon/GuppyCamp
// 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)
}
示例#4
0
func NewMain(ctx ...interface{}) log15.Logger {
	return log15.Root().New(ctx...)
}