Beispiel #1
0
func newTestClient(rt http.RoundTripper) *errors.Client {
	t, err := errors.NewClient(context.Background(), testProjectID, "myservice", "v1.000", option.WithHTTPClient(&http.Client{Transport: rt}))
	if err != nil {
		panic(err)
	}
	t.RepanicDefault = false
	return t
}
func handleErrors(projectId string, deviceChan chan device, done chan struct{}, wg *sync.WaitGroup) {
	errorsClient, err := errors.NewClient(context.Background(), projectId, "devicemonitor", VERSION)
	if err != nil {
		log.Fatal("Could not create Stackdriver Error Reporting client: %v", err)
	}

	wg.Add(1)
	for {
		select {
		case d := <-deviceChan:
			handleError(errorsClient, d)
			continue
		case <-done:
			wg.Done()
			return
		}
	}
}