logger

package
v0.0.0-...-bc5839e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	LogConfig map[string]string

	ContainerID      string
	ContainerName    string
	ContainerImageID string
	ContainerEnvs    []string
	ContainerLabels  map[string]string
	ContainerRootDir string

	DaemonName string
}

Info provides container information for log driver.

TODO(fuwei): add more fields.

func (*Info) ExtraAttributes

func (i *Info) ExtraAttributes(keyMod func(string) string) (map[string]string, error)

ExtraAttributes returns the user-defined extra attributes (labels, environment variables) in key-value format.

NOTE: This can be used by log-driver which support metadata in log file.

func (*Info) FullID

func (i *Info) FullID() string

FullID returns the container ID.

func (*Info) ID

func (i *Info) ID() string

ID returns the container truncated ID.

func (*Info) ImageFullID

func (i *Info) ImageFullID() string

ImageFullID returns the container's image ID.

func (*Info) ImageID

func (i *Info) ImageID() string

ImageID returns the container's image truncated ID.

func (*Info) Name

func (i *Info) Name() string

Name returns the container name.

type LogCopier

type LogCopier struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

LogCopier is used to copy data from stream and write it into LogDriver.

func NewLogCopier

func NewLogCopier(dst LogDriver, srcs map[string]io.Reader) *LogCopier

NewLogCopier creates copier for logger.

func (*LogCopier) StartCopy

func (lc *LogCopier) StartCopy()

StartCopy starts to read the data and write it into logger.

type LogDriver

type LogDriver interface {
	Name() string

	WriteLogMessage(msg *LogMessage) error

	Close() error
}

LogDriver represents any kind of log drivers, such as jsonfile, syslog.

type LogMessage

type LogMessage struct {
	Source    string    // Source means stdin, stdout or stderr
	Line      []byte    // Line means the log content, but it maybe partial
	Timestamp time.Time // Timestamp means the created time of line
	Attrs     map[string]string
	Err       error
}

LogMessage represents the log message in the container json log.

type LogMode

type LogMode string

LogMode indicates available logging modes.

const (
	// LogModeDefault default to unuse buffer to make logs blocking.
	LogModeDefault = ""
	// LogModeBlocking means to unuse buffer to make logs blocking.
	LogModeBlocking LogMode = "blocking"
	// LogModeNonBlock means to use buffer to make logs non blocking.
	LogModeNonBlock LogMode = "non-blocking"
)

type LogWatcher

type LogWatcher struct {
	Msgs chan *LogMessage
	Err  chan error
	// contains filtered or unexported fields
}

LogWatcher is used to pass the log message to the reader.

func NewLogWatcher

func NewLogWatcher() *LogWatcher

NewLogWatcher returns new LogWatcher.

func (*LogWatcher) Close

func (w *LogWatcher) Close()

Close closes LogWatcher.

func (*LogWatcher) WatchClose

func (w *LogWatcher) WatchClose() <-chan struct{}

WatchClose returns the close notifier.

type ReadConfig

type ReadConfig struct {
	Since   time.Time
	Until   time.Time
	Tail    int
	Follow  bool
	Details bool
}

ReadConfig is used to

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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