Documentation ¶
Overview ¶
Package logger defines interfaces that logger drivers implement to log messages.
The other half of a logger driver is the implementation of the factory, which holds the contextual instance information that allows multiple loggers of the same type to perform different actions, such as logging to different locations.
Index ¶
- Constants
- Variables
- func RegisterLogDriver(name string, c Creator) error
- func RegisterLogOptValidator(name string, l LogOptValidator) error
- func ValidateLogOpts(name string, cfg map[string]string) error
- type Context
- type Copier
- type Creator
- type LogOptValidator
- type LogReader
- type LogWatcher
- type Logger
- type Message
- type ReadConfig
Constants ¶
const ( // TimeFormat is the time format used for timestamps sent to log readers. TimeFormat = timeutils.RFC3339NanoFixed )
Variables ¶
var ErrReadLogsNotSupported = errors.New("configured logging reader does not support reading")
ErrReadLogsNotSupported is returned when the logger does not support reading logs.
Functions ¶
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 Context ¶
type Context struct { Config map[string]string ContainerID string ContainerName string ContainerEntrypoint string ContainerArgs []string ContainerImageID string ContainerImageName string ContainerCreated time.Time LogPath string }
Context provides enough information for a logging driver to do its function.
type Copier ¶
type Copier struct {
// contains filtered or unexported fields
}
Copier can copy logs from specified sources to Logger and attach ContainerID and 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 LogOptValidator ¶
LogOptValidator checks the options specific to the underlying logging implementation.
type LogReader ¶
type LogReader interface { // Read logs from underlying logging backend ReadLogs(ReadConfig) *LogWatcher }
LogReader is the interface for reading log messages for loggers that support reading.
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.
Directories ¶
Path | Synopsis |
---|---|
Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs
|
Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs |
Package fluentd provides the log driver for forwarding server logs to fluentd endpoints.
|
Package fluentd provides the log driver for forwarding server logs to fluentd endpoints. |
Package gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format.
|
Package gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format. |
Package journald provides the log driver for forwarding server logs to endpoints that receive the systemd format.
|
Package journald provides the log driver for forwarding server logs to endpoints that receive the systemd format. |
Package jsonfilelog provides the default Logger implementation for Docker logging.
|
Package jsonfilelog provides the default Logger implementation for Docker logging. |
Package syslog provides the logdriver for forwarding server logs to syslog endpoints.
|
Package syslog provides the logdriver for forwarding server logs to syslog endpoints. |