logsender

package
v0.0.0-...-4bd6544 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: AGPL-3.0 Imports: 12 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 logger worker, using the resource names defined in the supplied config.

func New

func New(logs LogRecordCh, logSenderAPI *logsender.API) worker.Worker

New starts a logsender worker which reads log message structs from a channel and sends them to the JES via the logsink API.

func UninstallBufferedLogWriter

func UninstallBufferedLogWriter() error

UninstallBufferedLogWriter removes the BufferedLogWriter previously installed by InstallBufferedLogWriter and closes it.

Types

type BufferedLogWriter

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

BufferedLogWriter is a loggo.Writer which buffers log messages in memory. These messages are retrieved by reading from the channel returned by the Logs method.

Up to maxLen log messages will be buffered. If this limit is exceeded, the oldest records will be automatically discarded.

func NewBufferedLogWriter

func NewBufferedLogWriter(maxLen int) *BufferedLogWriter

NewBufferedLogWriter returns a new BufferedLogWriter which will cache up to maxLen log messages.

func (*BufferedLogWriter) Close

func (w *BufferedLogWriter) Close()

Close cleans up the BufferedLogWriter instance. The output channel returned by the Logs method will be closed and any further Write calls will panic.

func (*BufferedLogWriter) Logs

func (w *BufferedLogWriter) Logs() LogRecordCh

Logs returns a channel which emits log messages that have been sent to the BufferedLogWriter instance.

func (*BufferedLogWriter) Write

func (w *BufferedLogWriter) Write(entry loggo.Entry)

Write sends a new log message to the writer. This implements the loggo.Writer interface.

type LogRecord

type LogRecord struct {
	Time     time.Time
	Module   string
	Location string // e.g. "foo.go:42"
	Level    loggo.Level
	Message  string

	// Number of messages dropped after this one due to buffer limit.
	DroppedAfter int
}

LogRecord represents a log message in an agent which is to be transmitted to the JES.

type LogRecordCh

type LogRecordCh chan *LogRecord

LogRecordCh defines the channel type used to send log message structs within the unit and machine agents.

func InstallBufferedLogWriter

func InstallBufferedLogWriter(maxLen int) (LogRecordCh, error)

InstallBufferedLogWriter creates a new BufferedLogWriter, registers it with Loggo and returns its output channel.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string
	LogSource     LogRecordCh
}

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

Jump to

Keyboard shortcuts

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