filemanager

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSourceRequestPath

func GetSourceRequestPath(recordDir, requestID string) string

func GetSourceResponsePath

func GetSourceResponsePath(recordDir, requestID string) string

func LoadHttpRequest

func LoadHttpRequest(requestPath string) (*http.Request, error)

func LoadHttpResponse

func LoadHttpResponse(responsePath string) (*http.Response, error)

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

type ConfigError struct {
	Field   string
	Message string
}

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

func (*LogFileScanner) Close

func (lfs *LogFileScanner) Close()

Close closes the scanner

func (*LogFileScanner) Resume

func (lfs *LogFileScanner) Resume()

Resume resumes scanning

func (*LogFileScanner) Start

func (lfs *LogFileScanner) Start(ctx context.Context) error

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 OnError

type OnError func(err error)

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 Protocol

type Protocol string
const (
	ProtocolHTTP Protocol = "http"
	ProtocolGRPC Protocol = "gRPC"
)

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()

func (*TrafficWatchScanner) Start

func (tw *TrafficWatchScanner) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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