logsink

package
v0.0.0-...-0a82276 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs a log sink worker, using the resource names defined in the supplied config.

func NewModelLogger

func NewModelLogger(
	loggerForModelFunc corelogger.LogWriterForModelFunc,
	bufferSize int,
	flushInterval time.Duration,
	clock clock.Clock,
) corelogger.ModelLogger

NewModelLogger returns a new model logger instance. The actual loggers returned for each model are created by the supplied loggerForModelFunc.

func NewWorker

func NewWorker(cfg Config) (worker.Worker, error)

NewWorker returns a new worker which provides access to a log sink which allows log entries to be stored for specified models.

Types

type Config

type Config struct {
	Logger                logger.Logger
	Clock                 clock.Clock
	LogSinkConfig         LogSinkConfig
	LogWriterForModelFunc logger.LogWriterForModelFunc
}

Config defines the attributes used to create a log sink worker.

type LogSink

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

LogSink is a worker which provides access to a log sink which allows log entries to be stored for specified models.

func (*LogSink) Kill

func (ml *LogSink) Kill()

Kill implements Worker.Kill()

func (*LogSink) Wait

func (ml *LogSink) Wait() error

Wait implements Worker.Wait()

type LogSinkConfig

type LogSinkConfig struct {
	// LoggerBufferSize is the capacity of the log sink logger's buffer.
	LoggerBufferSize int

	// LoggerFlushInterval is the amount of time to allow a log record
	// to sit in the buffer before being flushed to the destination logger.
	LoggerFlushInterval time.Duration
}

LogSinkConfig holds parameters to control the log sink's behaviour.

func DefaultLogSinkConfig

func DefaultLogSinkConfig() LogSinkConfig

DefaultLogSinkConfig returns a LogSinkConfig with default values.

func (LogSinkConfig) Validate

func (cfg LogSinkConfig) Validate() error

Validate validates the logsink endpoint configuration.

type ManifoldConfig

type ManifoldConfig struct {
	// DebugLogger is used to emit debug messages.
	DebugLogger logger.Logger

	// NewWorker creates a log sink worker.
	NewWorker func(cfg Config) (worker.Worker, error)

	ClockName          string
	DomainServicesName string
	AgentName          string
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

Jump to

Keyboard shortcuts

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