logger

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 18 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LoggerConfigFilename = "export-config.yaml"
)

Variables

View Source
var (
	ErrorInvalidFormat = errors.New("invalid format: expected jsonl or yaml")
)

Functions

This section is empty.

Types

type Config added in v0.0.13

type Config struct {
	Kafka   kafka.Options   `yaml:"kafka"`
	Elastic elastic.Options `yaml:"elastic"`
}

Config is a configuration file for proxify logger module

type Logger

type Logger struct {
	Store []Store
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(options *OptionsLogger) *Logger

NewLogger instance

func (*Logger) AsyncWrite

func (l *Logger) AsyncWrite()

AsyncWrite data

func (*Logger) Close

func (l *Logger) Close()

Close logger instance

func (*Logger) LogRequest

func (l *Logger) LogRequest(req *http.Request, userdata types.UserData) error

LogRequest and user data

func (*Logger) LogResponse

func (l *Logger) LogResponse(resp *http.Response, userdata types.UserData) error

LogResponse and user data

type OptionsLogger

type OptionsLogger struct {
	Verbosity    types.Verbosity
	OutputFolder string // when output is written to multiple files
	OutputFile   string // when output is written to single file
	OutputFormat string // jsonl or yaml
	DumpRequest  bool   // dump request to file
	DumpResponse bool   // dump response to file
	MaxSize      int    // max size of the output
	Elastic      *elastic.Options
	Kafka        *kafka.Options
}

type OutputFileWriter added in v0.0.15

type OutputFileWriter interface {
	// Write writes a http transaction to the file.
	Write(data *types.HTTPRequestResponseLog) error
	// Close closes the file writer.
	Close() error
}

OutputFileWriter is an interface for writing structured data to a file.

func NewOutputFileWriter added in v0.0.15

func NewOutputFileWriter(format, filePath string) (OutputFileWriter, error)

NewOutputFileWriter creates a new output file writer

type Store

type Store interface {
	Save(data types.HTTPTransaction) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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