errreport

package
v1.0.0-alpha.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

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

func Capture(parent error, callerSkip int) Origin

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

func (o Origin) StackTrace() ([]byte, bool)

StackTrace implements sloggcp.StackTraceError.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL