debug

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearLogs

func ClearLogs()

ClearLogs clears all debug logs from the global debugger

func Disable

func Disable()

Disable disables global debugging

func Enable

func Enable()

Enable enables global debugging

func IsEnabled

func IsEnabled() bool

IsEnabled returns whether global debugging is enabled

func Log

func Log(level string, message string, fields map[string]interface{})

Log logs a message to the global debugger

func PrintStats

func PrintStats()

PrintStats prints runtime statistics globally

func Trace

func Trace(name string) func()

Trace traces function execution time globally

func WithContext

func WithContext(ctx context.Context) context.Context

WithContext returns a context with the debugger

Types

type ContextKey

type ContextKey struct{}

ContextKey is the key for storing debugger in context

type DebugLog

type DebugLog struct {
	Timestamp time.Time
	Level     string
	Message   string
	Fields    map[string]interface{}
}

DebugLog represents a debug log entry

func GetLogs

func GetLogs() []DebugLog

GetLogs returns all debug logs from the global debugger

type Debugger

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

Debugger provides debugging utilities for the RAG engine

func FromContext

func FromContext(ctx context.Context) *Debugger

FromContext gets the debugger from context

func NewDebugger

func NewDebugger() *Debugger

NewDebugger creates a new debugger

func (*Debugger) ClearLogs

func (d *Debugger) ClearLogs()

ClearLogs clears all debug logs

func (*Debugger) Disable

func (d *Debugger) Disable()

Disable disables debugging

func (*Debugger) Enable

func (d *Debugger) Enable()

Enable enables debugging

func (*Debugger) GetLogs

func (d *Debugger) GetLogs() []DebugLog

GetLogs returns all debug logs

func (*Debugger) IsEnabled

func (d *Debugger) IsEnabled() bool

IsEnabled returns whether debugging is enabled

func (*Debugger) Log

func (d *Debugger) Log(level string, message string, fields map[string]interface{})

Log logs a debug message

func (*Debugger) PrintStats

func (d *Debugger) PrintStats()

PrintStats prints runtime statistics

func (*Debugger) StartProfile

func (d *Debugger) StartProfile(profileType ProfileType, filename string) (func(), error)

StartProfile starts profiling

func (*Debugger) TraceFunction

func (d *Debugger) TraceFunction(name string) func()

TraceFunction traces function execution time

type ProfileType

type ProfileType string

ProfileType represents the type of profile

const (
	ProfileCPU       ProfileType = "cpu"
	ProfileMemory    ProfileType = "memory"
	ProfileGoroutine ProfileType = "goroutine"
)

Jump to

Keyboard shortcuts

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