trace

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Agent

func Agent(event string, data any)

Agent emits an agent subsystem trace event (verbose level).

func AgentDetailed

func AgentDetailed(event string, data any)

AgentDetailed emits an agent subsystem trace event (detailed level).

func AgentHigh

func AgentHigh(event string, data any)

AgentHigh emits an agent subsystem trace event (high level).

func Close

func Close()

Close closes the global tracer.

func Editor

func Editor(event string, data any)

Editor emits an editor subsystem trace event (verbose level).

func EditorDetailed

func EditorDetailed(event string, data any)

EditorDetailed emits an editor subsystem trace event (detailed level).

func EditorHigh

func EditorHigh(event string, data any)

EditorHigh emits an editor subsystem trace event (high level).

func Emit

func Emit(subsystem, event string, level Level, data any)

Emit writes a trace event.

func Enabled

func Enabled(subsystem string) bool

Enabled returns true if the subsystem is being traced.

func Init

func Init() error

Init initializes the global tracer from environment variables. HASH_TRACE: comma-separated subsystems (e.g., "editor,agent,all") HASH_TRACE_PATH: output file path (default: hash-trace.jsonl) HASH_TRACE_LEVEL: verbose, detailed, high (default: verbose)

func Parser

func Parser(event string, data any)

Parser emits a parser subsystem trace event (verbose level).

func ParserDetailed

func ParserDetailed(event string, data any)

ParserDetailed emits a parser subsystem trace event (detailed level).

func ParserHigh

func ParserHigh(event string, data any)

ParserHigh emits a parser subsystem trace event (high level).

func Shell

func Shell(event string, data any)

Shell emits a shell subsystem trace event (verbose level).

func ShellDetailed

func ShellDetailed(event string, data any)

ShellDetailed emits a shell subsystem trace event (detailed level).

func ShellHigh

func ShellHigh(event string, data any)

ShellHigh emits a shell subsystem trace event (high level).

Types

type Entry

type Entry struct {
	Timestamp string  `json:"ts"`
	DeltaMs   float64 `json:"delta_ms"`
	Goroutine int     `json:"goroutine"`
	Subsystem string  `json:"sub"`
	Level     Level   `json:"level"`
	Event     string  `json:"event"`
	Data      any     `json:"data,omitempty"`
}

Entry is a single trace event.

func EndEntry

func EndEntry(durationMs, eventsWritten int64) Entry

EndEntry creates the trace_end entry.

func StartEntry

func StartEntry(version string, subsystems []string, level Level, pid int) Entry

StartEntry creates the trace_start entry.

func (Entry) MarshalJSON

func (e Entry) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type Level

type Level string

Level represents trace verbosity.

const (
	LevelVerbose  Level = "verbose"
	LevelDetailed Level = "detailed"
	LevelHigh     Level = "high"
)

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

Tracer writes trace events to a file.

Jump to

Keyboard shortcuts

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