示例#1
0
func (r *Reporter) Init(c *client.Config) {
	reporters := strings.Split(reporterDestinations, ":")
	for _, rep := range reporters {
		newRep, err := reporter.Get(rep)
		if err != nil {
			if sentryClient := sentry.GetClient(); sentryClient != nil {
				sentryClient.CaptureError(err, map[string]string{})
			}

			// Allow other reporters to proceed
			continue
		}

		if newRep != nil {
			log.Printf("[multireporter] Initialization successful: %s", rep)
			r.reporterDestinations = append(r.reporterDestinations, newRep)
		}
	}

	log.Printf("[multireporter] Setting up multiple client reporters: %s\n", reporters)

	for _, rep := range r.reporterDestinations {
		rep.Init(c)
	}
}
示例#2
0
func RunBuildPlan(config *client.Config) (Result, error) {
	var err error

	currentAdapter, err := adapter.Get(selectedAdapter)
	if err != nil {
		return RESULT_INFRA_FAILED, err
	}

	currentReporter, err := reporter.Get(selectedReporter)
	if err != nil {
		log.Printf("[engine] failed to initialize reporter: %s", selectedReporter)
		return RESULT_INFRA_FAILED, err
	}
	log.Printf("[engine] started with reporter %s, adapter %s", selectedReporter, selectedAdapter)

	engine := &Engine{
		config:    config,
		clientLog: client.NewLog(),
		adapter:   currentAdapter,
		reporter:  currentReporter,
	}

	return engine.Run()
}