Documentation
¶
Overview ¶
Package errreport centralizes error location and stack capture for structured logging and GCP Error Reporting (ADR 030). It is a leaf package: it depends only on sloggcp and the runtime, not on domain or storage types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableLocation ¶
func EnableLocation(enable bool)
EnableLocation toggles structured report-location capture for newly constructed errors when no deeper location exists in the parent chain.
func EnableStack ¶
func EnableStack(enable bool)
EnableStack toggles stack capture for newly constructed errors when no deeper stack exists in the parent chain.
func GCPReporting ¶
func GCPReporting(enable bool)
GCPReporting toggles GCP Error Reporting log shaping. When enabled, per-error LogValue implementations omit location and stack because the GCP handler adds them from the ReportLocationError / StackTraceError interfaces.
func GCPReportingEnabled ¶
func GCPReportingEnabled() bool
GCPReportingEnabled reports whether GCP Error Reporting shaping is active.
Types ¶
type Origin ¶
type Origin struct {
// contains filtered or unexported fields
}
Origin carries structured report location and an optional stack trace. Embed it in layer-specific error types and implement sloggcp interfaces via the promoted methods.
func Capture ¶
Capture records diagnostic origin metadata for a newly constructed error.
Location and stack follow deepest-first inheritance: when parent already implements the sloggcp interfaces anywhere in its unwrap chain, the deepest values are reused. Otherwise a fresh location and/or stack is captured when the corresponding global toggle is enabled.
callerSkip is the number of frames to skip to reach the logical construction call site, matching runtime.Caller at that site (for example 2 from domain.newError, 1 from domain.Error.WithParent).
func (Origin) ReportLocation ¶
func (o Origin) ReportLocation() *sloggcp.ReportLocation
ReportLocation implements sloggcp.ReportLocationError.
func (Origin) StackTrace ¶
StackTrace implements sloggcp.StackTraceError.