Documentation
¶
Index ¶
- Variables
- func GroupedFormatter(frames FramesRoles, processor Processor) []byte
- func InlineFormatter(frames FramesRoles, processor Processor) []byte
- func Stack(formatter Formatter, opts ...option) stack.Provider
- func WithProcessor(processor Processor) option
- type Formatter
- type FrameRole
- type FramesRoles
- type Processor
Constants ¶
This section is empty.
Variables ¶
var RolePriority = []FrameRole{ RoleOrigin, RoleStack, }
RolePriority defines the order in which frame roles should be processed or displayed.
Functions ¶
func GroupedFormatter ¶
func GroupedFormatter(frames FramesRoles, processor Processor) []byte
GroupedFormatter formats frames grouped by their role.
Each role is rendered as a separate section headed by the role name, followed by the frames that belong to that role.
Example:
ORIGIN main.main [cmd/app/main.go:10] STACK service.Run [internal/service/run.go:42] handler.Execute [internal/handler/execute.go:17]
func InlineFormatter ¶
func InlineFormatter(frames FramesRoles, processor Processor) []byte
InlineFormatter formats frames as a flat list.
Frames marked as RoleOrigin are prefixed with "->" while all other frames use a neutral marker.
Example:
-> main.main [cmd/app/main.go:10] service.Run [internal/service/run.go:42] handler.Execute [internal/handler/execute.go:17]
func Stack ¶
Stack returns a stack provider that captures the current stack trace and formats it using the provided formatter and options.
func WithProcessor ¶
func WithProcessor(processor Processor) option
WithProcessor configures the Processor used to transform frame paths before they are formatted.
Types ¶
type Formatter ¶
type Formatter func(FramesRoles, Processor) []byte
Formatter formats a collection of stack frames into a compact textual representation.
type FrameRole ¶
type FrameRole string
FrameRole identifies the role of a stack frame within a processed stack trace.
type FramesRoles ¶
type FramesRoles map[FrameRole][]stackFrame
FramesRoles groups stack frames by their assigned role.
type Processor ¶
Processor transforms a stack frame path into a different representation.
func EmptyProcessor ¶
func EmptyProcessor() Processor
EmptyProcessor returns a Processor that leaves paths unchanged.
func StandardProcessor ¶
func StandardProcessor() Processor
StandardProcessor returns a Processor that converts absolute file paths into paths relative to the current project when possible.
If the project root cannot be determined, the returned Processor leaves paths unchanged.