예제 #1
0
func (ctx *bootContext) setLogVerbose(verbose int) {
	// prefer command line v option
	if ctx.vFlag >= 0 {
		log.SetLogVerbose(ctx.vFlag)
	} else {
		log.SetLogVerbose(verbose)
	}
}
예제 #2
0
// global before handler
func (ctx *bootContext) initialize(c *cli.Context) (err error) {
	// inject parameters into package.tunnel
	VER_STRING = versionString()
	VERSION = version
	DEBUG = ctx.debug
	// inject parameters into package.exception
	ex.DEBUG = ctx.debug
	// glog
	ctx.vSpecified = c.IsSet("v")
	log.SetLogOutput(ctx.logdir)
	log.SetLogVerbose(ctx.vFlag)
	return nil
}
예제 #3
0
func init() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	v := initAddonArgs(0)
	log.SetLogOutput("")
	log.SetLogVerbose(v)
	cltAddr += strconv.FormatInt(randomRange(1, 1<<13)+3e4, 10)
	svrAddr += strconv.FormatInt(randomRange(1, 1<<13)+3e4, 10)
	dstAddr += strconv.FormatInt(randomRange(1, 1<<13)+3e4, 10)
	fmt.Println("=== deblocus TEST ===")
	printArgLine("logV", v)
	printArgLine("cltAddr", cltAddr)
	printArgLine("svrAddr", svrAddr)
	printArgLine("dstAddr", dstAddr)
	fmt.Println("\n")
}
예제 #4
0
func (ctx *bootContext) initConfig(r ServerRole) (role ServerRole) {
	var err error
	// load config file
	ctx.cman, err = DetectConfig(ctx.configFile)
	fatalError(err)
	// parse config file
	role, err = ctx.cman.InitConfigByRole(r)
	if role == 0 {
		err = fmt.Errorf("No server role defined in config")
	}
	fatalError(err)
	if !ctx.vSpecified { // no -v
		// set logV with config.v
		if v := ctx.cman.LogV(role); v > 0 {
			log.SetLogVerbose(v)
		}
	}
	return role
}