juju: github.com/juju/juju/worker/logsender Index | Files | Directories

package logsender

import "github.com/juju/juju/worker/logsender"

Index

Package Files

bufferedlogwriter.go manifold.go worker.go

func Manifold Uses

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 Uses

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 controller via the logsink API.

func UninstallBufferedLogWriter Uses

func UninstallBufferedLogWriter() error

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

type BufferedLogWriter Uses

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 InstallBufferedLogWriter Uses

func InstallBufferedLogWriter(maxLen int) (*BufferedLogWriter, error)

InstallBufferedLogWriter creates and returns a new BufferedLogWriter, registering it with Loggo.

func NewBufferedLogWriter Uses

func NewBufferedLogWriter(maxLen int) *BufferedLogWriter

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

func (*BufferedLogWriter) Capacity Uses

func (w *BufferedLogWriter) Capacity() int

Capacity returns the capacity of the BufferedLogWriter.

func (*BufferedLogWriter) Close Uses

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 Uses

func (w *BufferedLogWriter) Logs() LogRecordCh

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

func (*BufferedLogWriter) Stats Uses

func (w *BufferedLogWriter) Stats() LogStats

Stats returns the current LogStats for this BufferedLogWriter.

func (*BufferedLogWriter) Write Uses

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

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

type LogRecord Uses

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 Uses

type LogRecordCh chan *LogRecord

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

type LogStats Uses

type LogStats struct {
    // Enqueued is the number of log messages enqueued.
    Enqueued uint64

    // Sent is the number of log messages sent.
    Sent uint64

    // Dropped is the number of log messages dropped from the queue.
    Dropped uint64
}

LogStats contains statistics on logging.

type ManifoldConfig Uses

type ManifoldConfig struct {
    APICallerName string
    LogSource     LogRecordCh
}

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

Directories

PathSynopsis
logsendermetrics
logsendertestPackage logsendertest provides testing utilities related to the logsender package.

Package logsender imports 14 packages (graph) and is imported by 129 packages. Updated 2019-10-03. Refresh now. Tools for package owners.