Documentation ¶
Index ¶
- Variables
- func PutMessage(msg *Message)
- func RegisterLogDriver(name string, c Creator) error
- func RegisterLogOptValidator(name string, l LogOptValidator) error
- func ValidateLogOpts(name string, cfg map[string]string) error
- type ContainerEvent
- type ContainerLog
- type ContainerLogManage
- type Copier
- type Creator
- type Info
- func (info *Info) Command() string
- func (info *Info) ExtraAttributes(keyMod func(string) string) map[string]string
- func (info *Info) FullID() string
- func (info *Info) Hostname() (string, error)
- func (info *Info) ID() string
- func (info *Info) ImageFullID() string
- func (info *Info) ImageID() string
- func (info *Info) ImageName() string
- func (info *Info) Name() string
- type LogAttributes
- type LogOptValidator
- type LogWatcher
- type Logger
- type Message
Constants ¶
This section is empty.
Variables ¶
var ErrNeglectedContainer = fmt.Errorf("Neglected container")
ErrNeglectedContainer not define logger name
var ErrReadLogsNotSupported = errors.New("configured logging driver does not support reading")
ErrReadLogsNotSupported is returned when the logger does not support reading logs.
var RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
RFC3339NanoFixed time format
Functions ¶
func PutMessage ¶
func PutMessage(msg *Message)
PutMessage puts the specified message back n the message pool. The message fields are reset before putting into the pool.
func RegisterLogDriver ¶
RegisterLogDriver registers the given logging driver builder with given logging driver name.
func RegisterLogOptValidator ¶
func RegisterLogOptValidator(name string, l LogOptValidator) error
RegisterLogOptValidator registers the logging option validator with the given logging driver name.
Types ¶
type ContainerEvent ¶
type ContainerEvent struct { Action string Container types.ContainerJSON }
ContainerEvent container event
type ContainerLog ¶
type ContainerLog struct { types.ContainerJSON LogCopier *Copier LogDriver Logger // contains filtered or unexported fields }
ContainerLog container log struct
func (*ContainerLog) StartLogger ¶
func (container *ContainerLog) StartLogger() (Logger, error)
StartLogger starts a new logger driver for the container.
type ContainerLogManage ¶
type ContainerLogManage struct {
// contains filtered or unexported fields
}
ContainerLogManage container log manage
func CreatContainerLogManage ¶
func CreatContainerLogManage(conf *option.Conf) *ContainerLogManage
CreatContainerLogManage create a container log manage
type Copier ¶
type Copier struct {
// contains filtered or unexported fields
}
Copier can copy logs from specified sources to Logger and attach Timestamp. Writes are concurrent, so you need implement some sync in your logger.
type Creator ¶
Creator builds a logging driver instance with given context.
func GetLogDriver ¶
GetLogDriver provides the logging driver builder for a logging driver name.
type Info ¶
type Info struct { Config map[string]string ContainerID string ContainerName string ContainerEntrypoint string ContainerArgs []string ContainerImageID string ContainerImageName string ContainerCreated time.Time ContainerEnv []string ContainerLabels map[string]string LogPath string DaemonName string }
Info provides enough information for a logging driver to do its function.
func (*Info) Command ¶
Command returns the command that the container being logged was started with. The Entrypoint is prepended to the container arguments.
func (*Info) ExtraAttributes ¶
ExtraAttributes returns the user-defined extra attributes (labels, environment variables) in key-value format. This can be used by log drivers that support metadata to add more context to a log.
func (*Info) ImageFullID ¶
ImageFullID is an alias of ContainerImageID.
type LogAttributes ¶
LogAttributes is used to hold the extra attributes available in the log message Primarily used for converting the map type to string and sorting.
type LogOptValidator ¶
LogOptValidator checks the options specific to the underlying logging implementation.
type LogWatcher ¶
type LogWatcher struct { // For sending log messages to a reader. Msg chan *Message // For sending error messages that occur while while reading logs. Err chan error // contains filtered or unexported fields }
LogWatcher is used when consuming logs read from the LogReader interface.
func (*LogWatcher) Close ¶
func (w *LogWatcher) Close()
Close notifies the underlying log reader to stop.
func (*LogWatcher) WatchClose ¶
func (w *LogWatcher) WatchClose() <-chan struct{}
WatchClose returns a channel receiver that receives notification when the watcher has been closed. This should only be called from one goroutine.
type Message ¶
type Message struct { Line []byte Source string Timestamp time.Time Attrs LogAttributes Partial bool }
Message is datastructure that represents piece of output produced by some container. The Line member is a slice of an array whose contents can be changed after a log driver's Log() method returns. Any changes made to this struct must also be updated in the `reset` function
func NewMessage ¶
func NewMessage() *Message
NewMessage returns a new message from the message sync.Pool