Documentation
¶
Overview ¶
Package debug provides debugging functionality for the defuddle content extraction system. It tracks removed elements, processing steps, timing information, and parsing statistics.
Index ¶
- type Debugger
- func (d *Debugger) AddProcessingStep(step, description string, elementsAffected int, details string)
- func (d *Debugger) AddRemovedElement(selector, reason, elementType, textContent string, count int)
- func (d *Debugger) EndTimer(operation string)
- func (d *Debugger) GetInfo() *Info
- func (d *Debugger) GetSummary() string
- func (d *Debugger) IsEnabled() bool
- func (d *Debugger) LogStep(step, description string, fn func() int)
- func (d *Debugger) SetExtractorUsed(extractor string)
- func (d *Debugger) SetStatistics(stats Statistics)
- func (d *Debugger) StartTimer(operation string)
- type Info
- type ProcessingStep
- type RemovedElement
- type Statistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debugger ¶
type Debugger struct {
// contains filtered or unexported fields
}
Debugger provides debugging functionality for the parsing process
func NewDebugger ¶
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 ¶
AddRemovedElement records an element that was removed
func (*Debugger) GetSummary ¶
GetSummary returns a human-readable summary of the debug information
func (*Debugger) SetExtractorUsed ¶
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 ¶
StartTimer starts a timer for the given operation
type Info ¶ added in v0.1.4
type Info 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"`
}
Info contains detailed debugging information about the parsing process
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