Back to godoc.org

Package debug

v1.2.0
Latest Go to latest

The highest tagged major version is v2.

Published: Feb 13, 2019 | License: Apache-2.0 | Module: github.com/gocolly/colly

Index

type Debugger

type Debugger interface {
	// Init initializes the backend
	Init() error
	// Event receives a new collector event.
	Event(e *Event)
}

Debugger is an interface for different type of debugging backends

type Event

type Event struct {
	// Type is the type of the event
	Type string
	// RequestID identifies the HTTP request of the Event
	RequestID uint32
	// CollectorID identifies the collector of the Event
	CollectorID uint32
	// Values contains the event's key-value pairs. Different type of events
	// can return different key-value pairs
	Values map[string]string
}

Event represents an action inside a collector

type LogDebugger

type LogDebugger struct {
	// Output is the log destination, anything can be used which implements them
	// io.Writer interface. Leave it blank to use STDERR
	Output io.Writer
	// Prefix appears at the beginning of each generated log line
	Prefix string
	// Flag defines the logging properties.
	Flag int
	// contains filtered or unexported fields
}

LogDebugger is the simplest debugger which prints log messages to the STDERR

func (*LogDebugger) Event

func (l *LogDebugger) Event(e *Event)

Event receives Collector events and prints them to STDERR

func (*LogDebugger) Init

func (l *LogDebugger) Init() error

Init initializes the LogDebugger

type WebDebugger

type WebDebugger struct {
	// Address is the address of the web server. It is 127.0.0.1:7676 by default.
	Address string

	CurrentRequests map[uint32]requestInfo
	RequestLog      []requestInfo
	// contains filtered or unexported fields
}

WebDebugger is a web based debuging frontend for colly

func (*WebDebugger) Event

func (w *WebDebugger) Event(e *Event)

Event updates the debugger's status

func (*WebDebugger) Init

func (w *WebDebugger) Init() error

Init initializes the WebDebugger

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier