loggerutils

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

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemplate = "{{.ID}}"

DefaultTemplate defines the defaults template logger should use.

Variables

This section is empty.

Functions

func ParseLogTag

func ParseLogTag(info logger.Info, defaultTemplate string) (string, error)

ParseLogTag generates a context aware tag for consistency across different log drivers based on the context of the running container.

Types

type LogFile

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

LogFile is Logger implementation for default Docker logging.

func NewLogFile

func NewLogFile(logPath string, capacity int64, maxFiles int, compress bool, marshaller logger.MarshalFunc, decodeFunc makeDecoderFunc, perms os.FileMode) (*LogFile, error)

NewLogFile creates new LogFile

func (*LogFile) Close

func (w *LogFile) Close() error

Close closes underlying file and signals all readers to stop.

func (*LogFile) MaxFiles

func (w *LogFile) MaxFiles() int

MaxFiles return maximum number of files

func (*LogFile) ReadLogs

func (w *LogFile) ReadLogs(config logger.ReadConfig, watcher *logger.LogWatcher)

ReadLogs decodes entries from log files and sends them the passed in watcher

Note: Using the follow option can become inconsistent in cases with very frequent rotations and max log files is 1. TODO: Consider a different implementation which can effectively follow logs under frequent rotations.

func (*LogFile) WriteLogEntry

func (w *LogFile) WriteLogEntry(msg *logger.Message) error

WriteLogEntry writes the provided log message to the current log file. This may trigger a rotation event if the max file/capacity limits are hit.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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