// ListenTo will add eventhandlers to e. func (h *MetricsEventHandler) ListenTo(e *core.NormalizedEmitter) { e.AddListener(core.BuildStepStarted, h.BuildStepStarted) e.AddListener(core.BuildStepFinished, h.BuildStepFinished) e.AddListener(core.BuildStepsAdded, h.BuildStepsAdded) e.AddListener(core.BuildStarted, h.BuildStarted) e.AddListener(core.BuildFinished, h.BuildFinished) }
// ListenTo will add eventhandlers to e. func (h *ReportHandler) ListenTo(e *core.NormalizedEmitter) { e.AddListener(core.BuildFinished, h.PipelineFinished) e.AddListener(core.BuildStepFinished, h.StepFinished) e.AddListener(core.BuildStepsAdded, h.StepsAdded) e.AddListener(core.BuildStepStarted, h.StepStarted) e.AddListener(core.FullPipelineFinished, h.FullPipelineFinished) e.AddListener(core.Logs, h.Logs) }
// EmitStatus emits the json message on r func EmitStatus(e *core.NormalizedEmitter, r io.Reader, options *core.PipelineOptions) { s := NewJSONMessageProcessor() dec := json.NewDecoder(r) for { var m jsonmessage.JSONMessage if err := dec.Decode(&m); err == io.EOF { // Once the EOF is reached the function will stop break } else if err != nil { util.RootLogger().Panic(err) } line := s.ProcessJSONMessage(&m) e.Emit(core.Logs, &core.LogsArgs{ Logs: line, Stream: "docker", }) } }
// ListenTo will add eventhandlers to e. func (h *LiteralLogHandler) ListenTo(e *core.NormalizedEmitter) { e.AddListener(core.Logs, h.Logs) }