logger

package
v0.0.0-...-12adbad Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 10 Imported by: 17

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 logger worker, using the resource names defined in the supplied config.

func NewLogger

func NewLogger(config WorkerConfig) (worker.Worker, error)

NewLogger returns a worker.Worker that uses the notify watcher returned from the setup.

Types

type Logger

type Logger interface {
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Warningf(string, ...interface{})
	Errorf(string, ...interface{})
}

Logger represents a loggo logger for the purpose of recording what is going on.

type LoggerAPI

type LoggerAPI interface {
	LoggingConfig(agentTag names.Tag) (string, error)
	WatchLoggingConfig(agentTag names.Tag) (watcher.NotifyWatcher, error)
}

LoggerAPI represents the API calls the logger makes.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName       string
	APICallerName   string
	LoggingContext  *loggo.Context
	Logger          Logger
	UpdateAgentFunc func(string) error
}

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

type WorkerConfig

type WorkerConfig struct {
	Context  *loggo.Context
	API      LoggerAPI
	Tag      names.Tag
	Logger   Logger
	Override string

	Callback func(string) error
}

WorkerConfig contains the information required for the Logger worker to operate.

func (*WorkerConfig) Validate

func (c *WorkerConfig) Validate() error

Validate ensures all the necessary fields have values.

Jump to

Keyboard shortcuts

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