debug

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugInfo

type DebugInfo struct {
	RemovedElements []RemovedElement `json:"removedElements"`
	ProcessingSteps []ProcessingStep `json:"processingSteps"`
	Timings         map[string]int64 `json:"timings"` // Duration in nanoseconds
	Statistics      Statistics       `json:"statistics"`
	ExtractorUsed   string           `json:"extractorUsed,omitempty"`
}

DebugInfo contains detailed debugging information about the parsing process

type Debugger

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

Debugger provides debugging functionality for the parsing process

func NewDebugger

func NewDebugger(enabled bool) *Debugger

NewDebugger creates a new debugger instance

func (*Debugger) AddProcessingStep

func (d *Debugger) AddProcessingStep(step, description string, elementsAffected int, details string)

AddProcessingStep records a processing step

func (*Debugger) AddRemovedElement

func (d *Debugger) AddRemovedElement(selector, reason, elementType, textContent string, count int)

AddRemovedElement records an element that was removed

func (*Debugger) EndTimer

func (d *Debugger) EndTimer(operation string)

EndTimer ends a timer for the given operation

func (*Debugger) GetDebugInfo

func (d *Debugger) GetDebugInfo() *DebugInfo

GetDebugInfo returns the collected debug information

func (*Debugger) GetSummary

func (d *Debugger) GetSummary() string

GetSummary returns a human-readable summary of the debug information

func (*Debugger) IsEnabled

func (d *Debugger) IsEnabled() bool

IsEnabled returns whether debugging is enabled

func (*Debugger) LogStep

func (d *Debugger) LogStep(step, description string, fn func() int)

LogStep is a convenience method to log a processing step with timing

func (*Debugger) SetExtractorUsed

func (d *Debugger) SetExtractorUsed(extractor string)

SetExtractorUsed sets the name of the extractor that was used

func (*Debugger) SetStatistics

func (d *Debugger) SetStatistics(stats Statistics)

SetStatistics sets the parsing statistics

func (*Debugger) StartTimer

func (d *Debugger) StartTimer(operation string)

StartTimer starts a timer for the given operation

type ProcessingStep

type ProcessingStep struct {
	Step             string        `json:"step"`
	Description      string        `json:"description"`
	Duration         time.Duration `json:"duration"`
	ElementsAffected int           `json:"elementsAffected"`
	Details          string        `json:"details,omitempty"`
}

ProcessingStep represents a step in the content processing pipeline

type RemovedElement

type RemovedElement struct {
	Selector    string `json:"selector"`
	Reason      string `json:"reason"`
	Count       int    `json:"count"`
	ElementType string `json:"elementType"`
	TextContent string `json:"textContent,omitempty"`
}

RemovedElement represents an element that was removed during processing

type Statistics

type Statistics struct {
	OriginalElementCount int `json:"originalElementCount"`
	FinalElementCount    int `json:"finalElementCount"`
	RemovedElementCount  int `json:"removedElementCount"`
	WordCount            int `json:"wordCount"`
	CharacterCount       int `json:"characterCount"`
	ImageCount           int `json:"imageCount"`
	LinkCount            int `json:"linkCount"`
}

Statistics contains parsing statistics

Jump to

Keyboard shortcuts

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