log

package
v2.5.8 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBodyLimit limits request_body and response_body fields to 8KB each.
	DefaultBodyLimit = 8 * 1024
)

Variables

View Source
var ErrSinkClosed = errors.New("log sink is closed")

Functions

func NewLogger added in v2.5.7

func NewLogger(elogger echo.Logger, options ...LoggerOptions) (*logger, error)

func NewSentryExtractor added in v2.5.7

func NewSentryExtractor() *sentryExtractor

func NewSink added in v2.5.7

func NewSink(out io.WriteCloser, payloadTrace string, cfg SinkConfig) (*sink, error)

func Shutdown added in v2.5.7

func Shutdown(ctx context.Context) error

Types

type AccessLogger added in v2.5.7

type AccessLogger interface {
	TraceInfo(ctx context.Context, level string, fields map[string]any)
	TraceError(ctx context.Context, level string, fields map[string]any)
}

type BeanLogger added in v2.5.7

type BeanLogger interface {
	echo.Logger
	AccessLogger
}

func Init added in v2.5.7

func Init(logger echo.Logger) BeanLogger

func Logger

func Logger() BeanLogger

type Config added in v2.5.7

type Config struct {
	// contains filtered or unexported fields
}

type Entry added in v2.5.7

type Entry struct {
	Timestamp time.Time
	Severity  Severity
	Level     string
	Fields    map[string]any
	Trace     Trace
}

type LoggerOptions added in v2.5.7

type LoggerOptions func(*Config)

func WithAccessLogPath added in v2.5.7

func WithAccessLogPath(accessLogPath string) LoggerOptions

func WithBodyLimit added in v2.5.8

func WithBodyLimit(bodyLimit int) LoggerOptions

func WithMaskFields added in v2.5.7

func WithMaskFields(maskFields []string) LoggerOptions

func WithRuntimePlatform added in v2.5.7

func WithRuntimePlatform(platform string) LoggerOptions

func WithSinkAsync added in v2.5.7

func WithSinkAsync(async bool, queueSize int) LoggerOptions

type MaskProcessor added in v2.5.7

type MaskProcessor struct {
	// contains filtered or unexported fields
}

func NewMaskProcessor added in v2.5.7

func NewMaskProcessor(fields []string) *MaskProcessor

func (*MaskProcessor) Process added in v2.5.7

func (p *MaskProcessor) Process(entry Entry) Entry

type NopWriteCloser added in v2.5.7

type NopWriteCloser struct{ io.Writer }

NopWriteCloser wraps an io.Writer with a no-op Close so it satisfies io.WriteCloser.

func (NopWriteCloser) Close added in v2.5.7

func (NopWriteCloser) Close() error

type Pipeline added in v2.5.7

type Pipeline struct {
	// contains filtered or unexported fields
}

func NewPipeline added in v2.5.7

func NewPipeline(sink Sink, processors ...Processor) *Pipeline

func (*Pipeline) Close added in v2.5.7

func (p *Pipeline) Close(ctx context.Context) error

func (*Pipeline) Process added in v2.5.7

func (p *Pipeline) Process(entry Entry) error

type Processor added in v2.5.7

type Processor interface {
	Process(entry Entry) Entry
}

type RemoveEscapeProcessor added in v2.5.7

type RemoveEscapeProcessor struct{}

func NewRemoveEscapeProcessor added in v2.5.7

func NewRemoveEscapeProcessor() *RemoveEscapeProcessor

func (*RemoveEscapeProcessor) Process added in v2.5.7

func (p *RemoveEscapeProcessor) Process(entry Entry) Entry

type Severity added in v2.5.7

type Severity string
const (
	Debug    Severity = "DEBUG"
	Info     Severity = "INFO"
	Warning  Severity = "WARNING"
	Error    Severity = "ERROR"
	Critical Severity = "CRITICAL"
)

type Sink added in v2.5.7

type Sink interface {
	Write(entry Entry) error
}

type SinkConfig added in v2.5.7

type SinkConfig struct {
	Async     bool
	QueueSize int
	BodyLimit int
}

type Trace added in v2.5.7

type Trace struct {
	TraceID string
	SpanID  string
}

type TraceExtractor added in v2.5.7

type TraceExtractor interface {
	Extract(ctx context.Context) Trace
}

type TruncateBodyProcessor added in v2.5.8

type TruncateBodyProcessor struct {
	// contains filtered or unexported fields
}

func NewTruncateBodyProcessor added in v2.5.8

func NewTruncateBodyProcessor(bodyLimit int) *TruncateBodyProcessor

func (*TruncateBodyProcessor) Process added in v2.5.8

func (p *TruncateBodyProcessor) Process(entry Entry) Entry

Jump to

Keyboard shortcuts

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