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

	LoadTestDataOnce()

	builtins.LoadAllBuiltins()
}
Example #2
0
func init() {
	flag.Parse()
	if testing.Verbose() {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
}
Example #3
0
func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
}
Example #4
0
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{'[', '`'}
}
Example #5
0
func init() {
	// Register our Datasources in registry
	Register("csv", &CsvDataSource{})
	Register("csvtest", &csvStringSource{testData: testData})

	u.SetupLogging("debug")
	u.SetColorOutput()
}
Example #6
0
func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
	builtins.LoadAllBuiltins()
}
Example #7
0
func init() {
	flag.Parse()
	// Register our Datasources in registry
	datasource.Register(sourceType, &StaticDataSource{})
	if testing.Verbose() {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}
}
Example #8
0
func init() {
	lex.IDENTITY_CHARS = lex.IDENTITY_SQL_CHARS
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}

	builtins.LoadAllBuiltins()
}
Example #9
0
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()
}
Example #10
0
func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}

	expr.FuncAdd("eq", Eq)
	expr.FuncAdd("toint", ToInt)
	expr.FuncAdd("yy", Yy)
}
Example #11
0
func init() {
	flag.Parse()
	if *VerboseTests {
		u.SetupLogging("debug")
		u.SetColorOutput()
	}

	builtins.LoadAllBuiltins()

	//expr.FuncAdd("eq", Eq)
	//expr.FuncAdd("toint", ToInt)
	//expr.FuncAdd("yy", Yy)
	//expr.FuncAdd("oneof", OneOfFunc)
}
Example #12
0
File: main.go Project: araddon/depr
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)
}
Example #13
0
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,"*****@*****.**","fishing","2012-10-17T17:29:39.738Z",82
hT2impsOPUREcVPc,"*****@*****.**","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
`

}
Example #14
0
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)
}
Example #15
0
// 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()

	})
}
Example #16
0
func init() {
	u.SetupLogging("debug")
}
Example #17
0
File: main.go Project: morya/loges
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
}
Example #18
0
func init() {
	flag.Parse()
	if testing.Verbose() {
		gou.SetupLogging("debug")
	}
}
Example #19
0
func init() {
	LoadAllBuiltins()
	u.SetupLogging("debug")
	u.SetColorOutput()
}