Exemplo n.º 1
0
func (c *bootContext) setLogVerbose(level int) {
	var vFlag = c.verbosity
	var v int = -1
	if len(vFlag) > 0 {
		if len(vFlag) == 1 && vFlag[0] >= 48 && vFlag[0] <= 57 {
			v = int(vFlag[0]) - 48
		} else {
			fmt.Println("Warning: invalid option -v=" + vFlag)
		}
	}
	if v >= 0 {
		log.Set_Verbose(v)
	} else {
		log.Set_Verbose(level)
	}
}
Exemplo n.º 2
0
func init() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	flag.Int("vv", 0, "vv")
	var fs = flag.NewFlagSet("deblocus", flag.ErrorHandling(0xffff))
	var null, _ = os.Open(os.DevNull)
	defer null.Close()
	fs.SetOutput(null)
	var v int
	fs.IntVar(&v, "vv", 0, "log verbose")
	var deblocusArgs []string
	deblocusArgs = append(deblocusArgs, os.Args[1:]...)
	fs.Parse(deblocusArgs)

	log.Set_output(true, "")
	log.Set_Verbose(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")
}