Documentation
¶
Overview ¶
Package reporter formats engine events for the user. Two sinks are provided: pretty (human, default) and json (one event per line, for scripting).
Index ¶
Constants ¶
const ( StatusSucceeded = "succeeded" StatusFailed = "failed" StatusInfraFailed = "infrafailed" StatusSkipped = "skipped" StatusNotRun = "not-run" StatusTimeout = "timeout" )
Status values that can appear on task-end. Existing values are unchanged; "timeout" is new in v1.2.
Variables ¶
This section is empty.
Functions ¶
func ResolveColor ¶ added in v1.2.0
ResolveColor decides whether to emit ANSI codes.
Precedence (highest first):
- mode = Always or Never — explicit user choice wins.
- NO_COLOR env (any non-empty value) — disables color, per https://no-color.org.
- FORCE_COLOR or CLICOLOR_FORCE (any non-empty value) — enables color.
- mode = Auto — color iff isTerminal.
env is the lookup function (typically os.LookupEnv) so this can be tested without touching process state.
Types ¶
type ColorMode ¶ added in v1.2.0
type ColorMode int
ColorMode is how the user requested coloring be decided.
func ParseColorMode ¶ added in v1.2.0
ParseColorMode accepts auto|always|never (case-insensitive). Empty string maps to ColorAuto.
type Event ¶
type Event struct {
Kind EventKind `json:"kind"`
Time time.Time `json:"time"`
RunID string `json:"runId,omitempty"`
Pipeline string `json:"pipeline,omitempty"`
Task string `json:"task,omitempty"`
Step string `json:"step,omitempty"`
Stream string `json:"stream,omitempty"` // stdout|stderr
Line string `json:"line,omitempty"`
Status string `json:"status,omitempty"`
ExitCode int `json:"exitCode,omitempty"`
Duration time.Duration `json:"durationMs,omitempty"`
Message string `json:"message,omitempty"`
// Attempt is 1-based and present on task-retry (the attempt that just
// failed) and on task-end (the attempt that produced the final outcome).
Attempt int `json:"attempt,omitempty"`
}
type EventKind ¶
type EventKind string
const ( EvtRunStart EventKind = "run-start" EvtRunEnd EventKind = "run-end" EvtTaskStart EventKind = "task-start" EvtTaskEnd EventKind = "task-end" EvtTaskSkip EventKind = "task-skip" EvtTaskRetry EventKind = "task-retry" EvtStepStart EventKind = "step-start" EvtStepEnd EventKind = "step-end" EvtStepLog EventKind = "step-log" EvtError EventKind = "error" )
type LogSink ¶
type LogSink struct {
// contains filtered or unexported fields
}
LogSink is the engine-facing log forwarder; reporters expose this so the backend interface stays decoupled from the reporter type.
func NewLogSink ¶
type PrettyOptions ¶ added in v1.2.0
type PrettyOptions struct {
Color bool // already resolved via ResolveColor
Verbosity Verbosity // Quiet | Normal | Verbose
}
PrettyOptions configures NewPretty.
type Tee ¶
type Tee struct {
// contains filtered or unexported fields
}
Tee writes each event to all underlying reporters.