jsonfile

package
v0.0.0-...-ba854f2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(info logger.Info) (logger.LogDriver, error)

Init initializes the jsonfile log driver.

func Marshal

func Marshal(msg *logger.LogMessage, rawAttrs []byte) ([]byte, error)

Marshal used to marshal LogMessage to byte[]

func ValidateLogOpt

func ValidateLogOpt(cfg map[string]string) error

ValidateLogOpt validate log options for json-file log driver

Types

type JSONLogFile

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

JSONLogFile is uses to log the container's stdout and stderr.

func NewJSONLogFile

func NewJSONLogFile(logPath string, perms os.FileMode, logConfig map[string]string, marshalFunc MarshalFunc) (*JSONLogFile, error)

NewJSONLogFile returns new JSONLogFile instance.

func (*JSONLogFile) Close

func (lf *JSONLogFile) Close() error

Close closes the file.

func (*JSONLogFile) Name

func (lf *JSONLogFile) Name() string

Name return the log driver's name.

func (*JSONLogFile) ReadLogMessages

func (lf *JSONLogFile) ReadLogMessages(cfg *logger.ReadConfig) *logger.LogWatcher

ReadLogMessages will create goroutine to read the log message and send it to LogWatcher.

func (*JSONLogFile) WriteLogMessage

func (lf *JSONLogFile) WriteLogMessage(msg *logger.LogMessage) error

WriteLogMessage will write the LogMessage into the file.

type MarshalFunc

type MarshalFunc func(message *logger.LogMessage) ([]byte, error)

MarshalFunc is the function of marshal the logMessage

Jump to

Keyboard shortcuts

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