logging

package
v1.8.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package logging provides implementations of runtime.LoggingManager.

Index

Constants

View Source
const (
	// Overall capacity of the log buffer (in raw bytes, memory size will be smaller due to compression).
	DesiredCapacity = 1048576
	// Some logs are tiny, no need to reserve too much memory.
	InitialCapacity = 16384
	// Chunk capacity is the length of each chunk, it should be
	// big enough for the compression to be efficient.
	ChunkCapacity = 65536
	// Number of zstd-compressed chunks to keep.
	NumCompressedChunks = (DesiredCapacity / ChunkCapacity) - 1
	// Safety gap to avoid buffer overruns, can be lowered as with compression we don't need much.
	SafetyGap = 1
)

These constants should some day move to config.

Variables

This section is empty.

Functions

func NewJSONLines

func NewJSONLines(cfg config.LoggingDestination) runtime.LogSender

NewJSONLines returns log sender that sends logs in JSON over TCP (newline-delimited) or UDP (one message per packet).

Types

type CircularBufferLoggingManager

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

CircularBufferLoggingManager implements logging to circular fixed size buffer.

func NewCircularBufferLoggingManager

func NewCircularBufferLoggingManager(fallbackLogger *log.Logger) *CircularBufferLoggingManager

NewCircularBufferLoggingManager initializes new CircularBufferLoggingManager.

func (*CircularBufferLoggingManager) RegisteredLogs added in v1.7.0

func (manager *CircularBufferLoggingManager) RegisteredLogs() []string

RegisteredLogs implements runtime.LoggingManager interface.

func (*CircularBufferLoggingManager) ServiceLog

func (manager *CircularBufferLoggingManager) ServiceLog(id string) runtime.LogHandler

ServiceLog implements runtime.LoggingManager interface.

func (*CircularBufferLoggingManager) SetSenders

func (manager *CircularBufferLoggingManager) SetSenders(senders []runtime.LogSender) []runtime.LogSender

SetSenders implements runtime.LoggingManager interface.

type FileLoggingManager

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

FileLoggingManager implements simple logging to files.

func NewFileLoggingManager

func NewFileLoggingManager(logDirectory string) *FileLoggingManager

NewFileLoggingManager initializes new FileLoggingManager.

func (*FileLoggingManager) RegisteredLogs added in v1.7.0

func (manager *FileLoggingManager) RegisteredLogs() []string

RegisteredLogs implements runtime.LoggingManager interface.

func (*FileLoggingManager) ServiceLog

func (manager *FileLoggingManager) ServiceLog(id string) runtime.LogHandler

ServiceLog implements runtime.LoggingManager interface.

func (*FileLoggingManager) SetSenders

func (manager *FileLoggingManager) SetSenders([]runtime.LogSender) []runtime.LogSender

SetSenders implements runtime.LoggingManager interface (by doing nothing).

type NullLoggingManager

type NullLoggingManager struct{}

NullLoggingManager sends all the logs to /dev/null.

func NewNullLoggingManager

func NewNullLoggingManager() *NullLoggingManager

NewNullLoggingManager initializes NullLoggingManager.

func (*NullLoggingManager) RegisteredLogs added in v1.7.0

func (*NullLoggingManager) RegisteredLogs() []string

RegisteredLogs implements runtime.LoggingManager interface (by doing nothing).

func (*NullLoggingManager) ServiceLog

func (*NullLoggingManager) ServiceLog(id string) runtime.LogHandler

ServiceLog implements LoggingManager.

func (*NullLoggingManager) SetSenders

SetSenders implements runtime.LoggingManager interface (by doing nothing).

Jump to

Keyboard shortcuts

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