Documentation
¶
Overview ¶
Package logger provides structured logging for the DAST crawler.
Index ¶
- Constants
- func Debug(msg string)
- func Debugf(format string, args ...interface{})
- func Error(msg string)
- func Errorf(format string, args ...interface{})
- func Info(msg string)
- func Infof(format string, args ...interface{})
- func SetGlobal(l *Logger)
- func Warn(msg string)
- func Warnf(format string, args ...interface{})
- type Config
- type Level
- type Logger
- func (l *Logger) CrawlEvent(level Level, url string, depth int, workerID int) *zerolog.Event
- func (l *Logger) Debug(msg string)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) DiscoveryEvent(discoveryType, url, source string)
- func (l *Logger) Error(msg string)
- func (l *Logger) ErrorEvent(err error, url string, operation string)
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Event(level Level) *zerolog.Event
- func (l *Logger) Fatal(msg string)
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(msg string)
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) RequestEvent(method, url string, statusCode int, duration time.Duration)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) StatsEvent(stats map[string]interface{})
- func (l *Logger) Warn(msg string)
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithComponent(component string) *Logger
- func (l *Logger) WithDepth(depth int) *Logger
- func (l *Logger) WithDuration(d time.Duration) *Logger
- func (l *Logger) WithError(err error) *Logger
- func (l *Logger) WithField(key string, value interface{}) *Logger
- func (l *Logger) WithFields(fields map[string]interface{}) *Logger
- func (l *Logger) WithURL(url string) *Logger
- func (l *Logger) WithWorker(workerID int) *Logger
Constants ¶
const ( DebugLevel = zerolog.DebugLevel InfoLevel = zerolog.InfoLevel WarnLevel = zerolog.WarnLevel ErrorLevel = zerolog.ErrorLevel FatalLevel = zerolog.FatalLevel )
Log levels.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a formatted debug message using the global logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a formatted error message using the global logger.
Types ¶
type Config ¶
type Config struct {
Level Level
Pretty bool // Use console writer (colored output)
Output io.Writer
TimeFormat string
Component string // Component name (e.g., "crawler", "browser", "queue")
}
Config holds logger configuration.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger wraps zerolog for structured logging.
func (*Logger) CrawlEvent ¶
CrawlEvent logs a crawl-related event with standard fields.
func (*Logger) DiscoveryEvent ¶
DiscoveryEvent logs a discovery event.
func (*Logger) ErrorEvent ¶
ErrorEvent logs an error event with context.
func (*Logger) RequestEvent ¶
RequestEvent logs an HTTP request event.
func (*Logger) StatsEvent ¶
StatsEvent logs statistics.
func (*Logger) WithComponent ¶
WithComponent returns a new logger with the component field set.
func (*Logger) WithDuration ¶
WithDuration returns a new logger with duration field.
func (*Logger) WithFields ¶
WithFields returns a new logger with additional fields.
func (*Logger) WithWorker ¶
WithWorker returns a new logger with worker ID field.