Documentation
¶
Overview ¶
Package errlog finishes a unit of work that failed: it decides the level of the result record, marks the span and counts errors without a recorded origin, from one errs.Report.
It does not write the record. The boundary logs it with its own logger and a context-taking call, so the correlation handler in internal/logger adds request_id, trace_id and span_id:
result := errlog.Finish(ctx, "http.request", err, errlog.Options{})
logger.LogAttrs(ctx, result.Level, "request failed", result.Attrs()...)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Async marks a unit with no external caller (a background run, a
// scheduled job, an event dispatch). A client fault there is this
// process's fault.
Async bool
// WillRetry reports that the unit will be retried automatically.
WillRetry bool
}
Options describes how the unit of work ended.
type Result ¶
type Result struct {
Report errs.Report
Level slog.Level
// contains filtered or unexported fields
}
Result is the error outcome of a unit of work and its record level.
func Event ¶
Event gives the fields of an event record: one failed attempt in a retry loop, a fallback, or a swallowed error. Its level is always WARN. An event does not decide the unit's outcome, so the span is left alone; an error without a recorded origin is still counted.