logging

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2016 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileRotator

type FileRotator struct {
	MaxFiles int   // MaxFiles is the maximum number of rotated files allowed in a path
	FileSize int64 // FileSize is the size a rotated file is allowed to grow
	// contains filtered or unexported fields
}

FileRotator writes bytes to a rotated set of files

func NewFileRotator

func NewFileRotator(path string, baseFile string, maxFiles int,
	fileSize int64, logger *log.Logger) (*FileRotator, error)

NewFileRotator returns a new file rotator

func (*FileRotator) Close

func (f *FileRotator) Close()

func (*FileRotator) Write

func (f *FileRotator) Write(p []byte) (n int, err error)

Write writes a byte array to a file and rotates the file if it's size becomes equal to the maximum size the user has defined.

type LogCollector

type LogCollector interface {
	LaunchCollector(ctx *LogCollectorContext) (*SyslogCollectorState, error)
	Exit() error
	UpdateLogConfig(logConfig *structs.LogConfig) error
}

LogCollector is an interface which allows a driver to launch a log server and update log configuration

type LogCollectorContext

type LogCollectorContext struct {
	// TaskName is the name of the Task
	TaskName string

	// AllocDir is the handle to do operations on the alloc dir of
	// the task
	AllocDir *allocdir.AllocDir

	// LogConfig provides configuration related to log rotation
	LogConfig *structs.LogConfig

	// PortUpperBound is the upper bound of the ports that we can use to start
	// the syslog server
	PortUpperBound uint

	// PortLowerBound is the lower bound of the ports that we can use to start
	// the syslog server
	PortLowerBound uint
}

LogCollectorContext holds context to configure the syslog server

type SyslogCollector

type SyslogCollector struct {
}

SyslogCollector is a LogCollector which starts a syslog server and does rotation to incoming stream

func NewSyslogCollector

func NewSyslogCollector(logger *log.Logger) *SyslogCollector

NewSyslogCollector returns an implementation of the SyslogCollector

func (*SyslogCollector) Exit

func (s *SyslogCollector) Exit() error

Exit kills the syslog server

func (*SyslogCollector) LaunchCollector

func (s *SyslogCollector) LaunchCollector(ctx *LogCollectorContext) (*SyslogCollectorState, error)

LaunchCollector launches a new syslog server and starts writing log lines to files and rotates them

func (*SyslogCollector) UpdateLogConfig

func (s *SyslogCollector) UpdateLogConfig(logConfig *structs.LogConfig) error

UpdateLogConfig updates the log configuration

type SyslogCollectorState

type SyslogCollectorState struct {
	IsolationConfig *cstructs.IsolationConfig
	Addr            string
}

SyslogCollectorState holds the address and islation information of a launched syslog server

type SyslogMessage added in v0.3.2

type SyslogMessage struct {
}

type SyslogServer added in v0.3.2

type SyslogServer struct {
}

func (*SyslogServer) Shutdown added in v0.3.2

func (s *SyslogServer) Shutdown()

Jump to

Keyboard shortcuts

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