• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang gou.SetupLogging函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/araddon/gou.SetupLogging函数的典型用法代码示例。如果您正苦于以下问题:Golang SetupLogging函数的具体用法?Golang SetupLogging怎么用?Golang SetupLogging使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了SetupLogging函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: init

func init() {
	flag.Parse()
	if testing.Verbose() {
		u.SetupLogging("debug")
	} else {
		u.SetupLogging("warn")
	}
	u.SetColorOutput()

	LoadTestDataOnce()

	builtins.LoadAllBuiltins()
}
开发者ID:schmichael,项目名称:qlbridge,代码行数:13,代码来源:exec_test.go


示例2: init

func init() {
	flag.Parse()
	if testing.Verbose() {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:7,代码来源:db_test.go


示例3: init

func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:7,代码来源:lexer_test.go


示例4: init

func init() {
	LoadAllBuiltins()
	u.SetupLogging("debug")
	u.SetColorOutput()

	// change quotes marks to NOT include double-quotes so we can use for values
	lex.IdentityQuoting = []byte{'[', '`'}
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:8,代码来源:builtins_test.go


示例5: init

func init() {
	// Register our Datasources in registry
	Register("csv", &CsvDataSource{})
	Register("csvtest", &csvStringSource{testData: testData})

	u.SetupLogging("debug")
	u.SetColorOutput()
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:8,代码来源:csv_test.go


示例6: init

func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
	builtins.LoadAllBuiltins()
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:8,代码来源:vm_test.go


示例7: init

func init() {
	flag.Parse()
	// Register our Datasources in registry
	datasource.Register(sourceType, &StaticDataSource{})
	if testing.Verbose() {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:9,代码来源:btree_test.go


示例8: init

func init() {
	lex.IDENTITY_CHARS = lex.IDENTITY_SQL_CHARS
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}

	builtins.LoadAllBuiltins()
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:10,代码来源:parse_sql_test.go


示例9: init

func init() {

	flag.StringVar(&logging, "logging", "info", "logging [ debug,info ]")
	flag.StringVar(&sqlText, "sql", "", "QL ish query multi-node such as [select user_id, yy(reg_date) from stdio];")
	flag.StringVar(&flagCsvDelimiter, "delimiter", ",", "delimiter:   default = comma [t,|]")
	flag.Parse()

	u.SetupLogging(logging)
	u.SetColorOutput()
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:10,代码来源:main.go


示例10: init

func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}

	expr.FuncAdd("eq", Eq)
	expr.FuncAdd("toint", ToInt)
	expr.FuncAdd("yy", Yy)
}
开发者ID:schmichael,项目名称:qlbridge,代码行数:11,代码来源:vm_test.go


示例11: main

func main() {
	flag.Parse()
	u.SetupLogging("debug")
	u.SetColorIfTerminal()
	deprlib.BASE_BRANCH = baseBranch

	yamlBytes, err := ioutil.ReadFile(config)
	//Debug(string(yamlBytes))
	quitIfErr(err)
	goroot := runtime.GOROOT()
	goCmdPath = goroot + "/bin/go"
	deprlib.GoCmdPath = goCmdPath

	var d deprlib.Dependencies
	err = yaml.Unmarshal(yamlBytes, &d)

	err = d.Run(allowNonClean)
	quitIfErr(err)
}
开发者ID:araddon,项目名称:depr,代码行数:19,代码来源:main.go


示例12: init

func init() {
	u.SetupLogging("debug")
	u.SetColorOutput()

	builtins.LoadAllBuiltins()

	u.Infof("show curent env info: %v", rtConf.Sources.String())

	mockcsv.MockData["users"] = `user_id,email,interests,reg_date,item_count
9Ip1aKbeZe2njCDM,"[email protected]","fishing","2012-10-17T17:29:39.738Z",82
hT2impsOPUREcVPc,"[email protected]","swimming","2009-12-11T19:53:31.547Z",12
hT2impsabc345c,"not_an_email","swimming","2009-12-11T19:53:31.547Z",12`

	mockcsv.MockData["orders"] = `user_id,item_id,price,order_date,item_count
9Ip1aKbeZe2njCDM,1,22.50,"2012-10-24T17:29:39.738Z",82
9Ip1aKbeZe2njCDM,1,22.50,"2012-10-24T17:29:39.738Z",82
`

}
开发者ID:chrislusf,项目名称:qlbridge,代码行数:19,代码来源:exec_test.go


示例13: main

func main() {
	gou.SetupLogging("debug")
	gou.SetColorOutput()

	var config Config
	if _, err := confl.DecodeFile("example.conf", &config); err != nil {
		fmt.Println(err)
		return
	}

	fmt.Printf("Title: %s\n", config.Title)
	fmt.Printf("Hand: %s %s, %s. Born: %s, Deceased? %v\n",
		config.Hand.Name, config.Hand.Org, config.Hand.Bio, config.Hand.DOB, config.Hand.Deceased)
	fmt.Printf("Location: %#v\n", config.Location)
	for name, person := range config.Seenwith {
		fmt.Printf("Seen With: %s (%s, %s)\n", name, person.Episode, person.Season)
	}
	fmt.Printf("Seasons: %v\n", config.Seasons)
	fmt.Printf("Description: %v\n", config.Description)
}
开发者ID:postfix,项目名称:confl,代码行数:20,代码来源:example.go


示例14: Setup

// SetupLogging enables -vv verbose logging or sends logs to /dev/null
// env var VERBOSELOGS=true was added to support verbose logging with alltests
func Setup() {
	setupOnce.Do(func() {

		if flag.CommandLine.Lookup("vv") == nil {
			verbose = flag.Bool("vv", false, "Verbose Logging?")
		}

		flag.Parse()
		if *verbose || os.Getenv("VERBOSELOGS") != "" {
			u.SetupLogging("debug")
			u.SetColorOutput()
		} else {
			// make sure logging is always non-nil
			dn, _ := os.Open(os.DevNull)
			u.SetLogger(log.New(dn, "", 0), "error")
		}

		builtins.LoadAllBuiltins()

	})
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:23,代码来源:harness.go


示例15: init

func init() {
	u.SetupLogging("debug")
}
开发者ID:zj8487,项目名称:lruttl,代码行数:3,代码来源:lru_cache_test.go


示例16: main

func main() {
	flag.Parse()
	u.SetupLogging(logLevel)
	u.SetColorIfTerminal() // this doesn't work if reading stdin
	if colorize {
		u.SetColorOutput()
	}

	done := make(chan bool)
	esHostName = cleanEsHost(esHostName)
	// if we have note specified tail files, then assume stdin
	if len(flag.Args()) == 0 && source == "tail" {
		source = "stdin"
	}

	u.Debugf("LOGES: filters=%s  es=%s argct=:%d source=%v ll=%s  args=%v",
		filters, esHostName, len(flag.Args()), source, logLevel, flag.Args())

	// Setup output first, to ensure its ready when Source starts
	// TODO:  suuport multiple outputs?
	switch output {
	case "elasticsearch":
		// update the Logstash date for the index occasionally
		go loges.UpdateLogstashIndex()
		// start an elasticsearch bulk worker, for sending to elasticsearch
		go loges.ToElasticSearch(msgChan, "golog", esHostName, ttl, exitIfNoMsgsDur, metricsToEs)
	case "stdout":
		u.Debug("setting output to stdout ", colorize)
		go loges.ToStdout(msgChan, colorize)
	default:
		Usage()
		os.Exit(1)
	}

	// TODO:  implement metrics out
	for _, metOut := range strings.Split(metricsOut, ",") {
		switch metOut {
		case "influxdb":
			// todo
		case "graphite":
			u.Infof("Registering Graphite Transform: host=%s prefix=%s", graphiteHost, graphitePrefix)
			loges.TransformRegister(loges.GraphiteTransform(logType, graphiteHost, graphitePrefix, true))
		}
	}

	// now set up the transforms/filters
	for _, filter := range strings.Split(filters, ",") {
		switch filter {
		case "stdfiles":
			loges.TransformRegister(loges.FileFormatter(logType, nil))
		case "fluentd":
			loges.TransformRegister(loges.FluentdFormatter(logType, nil))
		case "kafka":
			// TODO, finish conversion to sarama
			//loges.TransformRegister(kafka.KafkaFormatter)
		}
	}

	for _, sourceInput := range strings.Split(source, ",") {
		u.Warnf("source = %v", sourceInput)
		switch sourceInput {
		case "tail":
			for _, filename := range flag.Args() {
				tailDone := make(chan bool)
				go loges.TailFile(filename, tail.Config{Follow: true, ReOpen: true}, tailDone, msgChan)
			}
		case "http":
			go loges.HttpRun(httpPort, msgChan)
		//case "kafka":
		//	go kafka.RunKafkaConsumer(msgChan, partitionstr, topic, kafkaHost, offset, maxMsgCt, maxSize)
		case "stdin":
			go loges.StdinPruducer(msgChan)
		default:
			u.Error(sourceInput)
			println("No input set, required")
			Usage()
			os.Exit(1)
		}
	}
	u.Warn("end of main startup, until done")
	<-done
}
开发者ID:morya,项目名称:loges,代码行数:82,代码来源:main.go


示例17: init

func init() {
	flag.Parse()
	if testing.Verbose() {
		gou.SetupLogging("debug")
	}
}
开发者ID:jacqui,项目名称:elastigo,代码行数:6,代码来源:corebulk_test.go


示例18: init

func init() {
	LoadAllBuiltins()
	u.SetupLogging("debug")
	u.SetColorOutput()
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:5,代码来源:builtins_test.go



注:本文中的github.com/araddon/gou.SetupLogging函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang gou.Warnf函数代码示例发布时间:2022-05-24
下一篇:
Golang gou.SetColorOutput函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap