syslogger

package
v0.0.0-...-ac56535 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 11 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 the dbaccessor worker, using the resource names defined in the supplied config.

func NewDiscard

func NewDiscard(priority Priority, tag string) (io.WriteCloser, error)

NewDiscard creates a new WriteCloser that discards all writes and the close is a noop.

func NewSyslog

func NewSyslog(priority Priority, tag string) (io.WriteCloser, error)

NewSyslog creates a new instance of a syslog logger, which sends all logs to directly to the _local_ syslog. Returning a io.WriterCloser, so that we can ensure that the underlying logger can be closed when done.

func NewWorker

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

Types

type ManifoldConfig

type ManifoldConfig struct {
	NewWorker func(WorkerConfig) (worker.Worker, error)
	NewLogger NewLogger
}

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.

type NewLogger

type NewLogger func(Priority, string) (io.WriteCloser, error)

NewLogger is a factory function to create a new syslog logger.

type Priority

type Priority int
const (

	// From /usr/include/sys/syslog.h.
	// These are the same on Linux, BSD, and OS X.
	LOG_EMERG Priority = iota
	LOG_ALERT
	LOG_CRIT
	LOG_ERR
	LOG_WARNING
	LOG_NOTICE
	LOG_INFO
	LOG_DEBUG
)

type SysLogger

type SysLogger interface {
	Log([]corelogger.LogRecord) error
}

SysLogger defines an interface for logging log records.

type WorkerConfig

type WorkerConfig struct {
	NewLogger NewLogger
}

WorkerConfig encapsulates the configuration options for the dbaccessor worker.

func (*WorkerConfig) Validate

func (c *WorkerConfig) Validate() error

Validate ensures that the config values are valid.

Jump to

Keyboard shortcuts

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