Exemplo n.º 1
0
func main() {

	console, err := os.Create("data/console.log")
	if err != nil {
		panic(err)
	}
	defer console.Close()

	errLog, err := os.Create("data/error.log")
	if err != nil {
		panic(err)
	}
	defer errLog.Close()

	incedentLog, err := os.Create("data/incedents.log")
	if err != nil {
		panic(err)
	}
	defer incedentLog.Close()

	resultLog, err := os.Create("data/TestResults.log")
	if err != nil {
		panic(err)
	}
	defer resultLog.Close()

	log := logger.GoQALog{}
	log.Init()
	log.SetDebug(true)

	log.Add("default", logger.LogLevelAll, os.Stdout)
	log.Add("Console", logger.LogLevelMessage, console)
	log.Add("Error", logger.LogLevelError, errLog)
	log.Add("Incidents", logger.LogLevelWarning, incedentLog)
	log.Add("Resuts", logger.LogLevelResults, resultLog)

	log.LogMessage("running on platform %s", runtime.GOOS)
	log.LogMessage("First message")
	log.LogMessage("second message")
	log.LogMessage("third message")
	log.LogDebug("Debug message")
	log.LogWarning("Warning Will Robinson")
	log.LogPass("Test Passed")
	log.LogFail("Test Failed")
	log.LogError("Failure in script")

	log.Sync()

}
Exemplo n.º 2
0
func main() {

	chnExit := make(chan int)

	commandQueue := make(runner.CommandQueue, 100)
	log := logger.GoQALog{}
	log.Init()
	log.Add("default", logger.LOG_LEVEL_ALL, os.Stdout)
	//log.SetDebug(true)

	messageListener := runner.TCPConnector{}
	messageListener.Init(&log, &runner.JSON_Encode{}, MES_ADDRESS, MES_PORT)
	listener := runner.ExternalConnector{}
	listener.Init(&messageListener, &commandQueue, chnExit, &log)

	MockMatch := runner.BuildMockMatch{}
	chnBuildIn := make(chan runner.InternalCommandInfo)
	BuildMatcher := runner.InternalBuildMatcher{}
	BuildMatcher.Init(&MockMatch, chnBuildIn, &commandQueue, chnExit, &log)

	master := runner.Master{}
	master.Init(&listener, &commandQueue, chnExit, &log)
	//time.Sleep(time.Second * 1)

	//go runner.RunListener(&listener, &commandQueue, &chnExit)

	go BuildMatcher.Run()
	//time.Sleep(time.Second * 1)
	for i := 0; i < BUILDER_COUNT; i++ {
		go BuildRun(chnBuildIn, &log)
		time.Sleep(time.Millisecond * 200)
	}
	for i := 0; i < MESSAGE_COUNT; i++ {
		go GetStatusRun(&log)
		time.Sleep(time.Millisecond * 100)
	}

	log.LogMessage("Running master...")
	master.Run()

	log.LogMessage("Leaving Program....")
	time.Sleep(time.Second * 1)
}