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 InstallBufferedLogWriter ¶
func InstallBufferedLogWriter(maxLen int) (*BufferedLogWriter, error)
InstallBufferedLogWriter creates and returns a new BufferedLogWriter, registering it with Loggo.
func NewBufferedLogWriter ¶
func NewBufferedLogWriter(maxLen int) *BufferedLogWriter
NewBufferedLogWriter returns a new BufferedLogWriter which will cache up to maxLen log messages.
func (*BufferedLogWriter) Capacity ¶
func (w *BufferedLogWriter) Capacity() int
Capacity returns the capacity of the BufferedLogWriter.
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) Stats ¶
func (w *BufferedLogWriter) Stats() LogStats
Stats returns the current LogStats for this BufferedLogWriter.
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.
type LogStats ¶
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 ¶
type ManifoldConfig struct { APICallerName string LogSource LogRecordCh }
ManifoldConfig defines the names of the manifolds on which a Manifold will depend.
Directories ¶
Path | Synopsis |
---|---|
Package logsendertest provides testing utilities related to the logsender package.
|
Package logsendertest provides testing utilities related to the logsender package. |