types

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressionNone = 0
	CompressionGzip = 1
)

Compression type constants

View Source
const (
	SamplingNone        = 0
	SamplingRandom      = 1
	SamplingAdaptive    = 2
	SamplingRateLimited = 3
	SamplingHead        = 4
	SamplingTail        = 5
	SamplingConsistent  = 6
)

Sampling strategy constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Write writes a log entry to the backend
	Write(entry []byte) (int, error)

	// Flush ensures all buffered data is written
	Flush() error

	// Close closes the backend
	Close() error

	// SupportsAtomic returns whether the backend supports atomic writes
	SupportsAtomic() bool
}

Backend interface for pluggable log backends

type BackendStats

type BackendStats struct {
	WriteCount     uint64
	BytesWritten   uint64
	ErrorCount     uint64
	LastError      time.Time
	TotalWriteTime time.Duration
	MaxWriteTime   time.Duration
}

BackendStats represents statistics for a backend

type Destination

type Destination struct {
	URI     string
	Backend Backend
}

Destination represents a log destination (for recovery.go)

type FilterFunc

type FilterFunc func(level int, message string, fields map[string]interface{}) bool

FilterFunc is a function that determines if a log entry should be logged

type Formatter

type Formatter interface {
	// Format formats a log message
	Format(msg LogMessage) ([]byte, error)
}

Formatter interface for pluggable log formatters

type LogEntry

type LogEntry struct {
	Fields     map[string]interface{} `json:"fields,omitempty"`
	File       string                 `json:"file,omitempty"`
	Level      string                 `json:"level"`
	Line       int                    `json:"line,omitempty"`
	Message    string                 `json:"message"`
	StackTrace string                 `json:"stack_trace,omitempty"`
	Timestamp  string                 `json:"timestamp"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"` // Additional metadata
}

LogEntry represents a structured log entry with all associated metadata. This is the internal representation of a log message that can be formatted as JSON or text output.

type LogMessage

type LogMessage struct {
	Level     int
	Format    string
	Args      []interface{}
	Entry     *LogEntry
	Timestamp time.Time
	Raw       []byte
	SyncDone  chan struct{} // Used for synchronization in Sync() calls
}

LogMessage represents a message to be logged by a background worker. This is the internal message type passed through channels for async logging.

Jump to

Keyboard shortcuts

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