Documentation
¶
Index ¶
- func GetSourceRequestPath(recordDir, requestID string) string
- func GetSourceResponsePath(recordDir, requestID string) string
- func LoadHttpRequest(requestPath string) (*http.Request, error)
- func LoadHttpResponse(responsePath string) (*http.Response, error)
- func WithLogFilePath(logFilePath string) func(*LogFileScannerConfig)
- func WithOnNewLogLine(onNewLine OnNewLogLineCallback) func(*LogFileScannerConfig)
- type ConfigError
- type LogEntry
- type LogFileScanner
- type LogFileScannerConfig
- type OnError
- type OnNewLogLineCallback
- type OnRequest
- type Protocol
- type RequestMetadata
- type ScannerConfig
- type TrafficWatchScanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSourceRequestPath ¶
func GetSourceResponsePath ¶
func WithLogFilePath ¶
func WithLogFilePath(logFilePath string) func(*LogFileScannerConfig)
WithLogFilePath sets the log file path
func WithOnNewLogLine ¶
func WithOnNewLogLine(onNewLine OnNewLogLineCallback) func(*LogFileScannerConfig)
WithOnNewLogLine sets the callback for new log lines
Types ¶
type ConfigError ¶
ConfigError represents a configuration error
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type LogEntry ¶
type LogEntry struct {
Timestamp time.Time
Level slog.Level
Message string
Attrs map[string]any
RawLine string
}
LogEntry represents a parsed log entry
type LogFileScanner ¶
type LogFileScanner struct {
// contains filtered or unexported fields
}
LogFileScanner scans log files for new entries
func NewLogFileScanner ¶
func NewLogFileScanner(cfg *LogFileScannerConfig) *LogFileScanner
NewLogFileScanner creates a new log file scanner
type LogFileScannerConfig ¶
type LogFileScannerConfig struct {
// contains filtered or unexported fields
}
LogFileScannerConfig holds configuration for the log file scanner
func NewLogFileScannerConfig ¶
func NewLogFileScannerConfig(opts ...func(*LogFileScannerConfig)) (*LogFileScannerConfig, error)
NewLogFileScannerConfig creates a new log file scanner config
type OnNewLogLineCallback ¶
type OnNewLogLineCallback func(entry LogEntry)
OnNewLogLineCallback is called when a new log line is found
type OnRequest ¶
type OnRequest func(reqMeta *RequestMetadata)
type RequestMetadata ¶
type RequestMetadata struct {
api.RequestMetadata
DoneAt time.Time `json:"doneAt"`
Protocol Protocol
}
type ScannerConfig ¶
type ScannerConfig struct {
TrafficDir string
Format config.OutputFormat
OnRequest OnRequest
OnError OnError
}
type TrafficWatchScanner ¶
type TrafficWatchScanner struct {
ScannerConfig
// contains filtered or unexported fields
}
func NewTrafficWatchScanner ¶
func NewTrafficWatchScanner(cfg *ScannerConfig) (*TrafficWatchScanner, error)
func (*TrafficWatchScanner) Close ¶
func (tw *TrafficWatchScanner) Close()
func (*TrafficWatchScanner) Init ¶
func (tw *TrafficWatchScanner) Init() []*RequestMetadata
func (*TrafficWatchScanner) Resume ¶
func (tw *TrafficWatchScanner) Resume()
Click to show internal directories.
Click to hide internal directories.