logger
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package logger defines interfaces that logger drivers implement tolog messages.
The other half of a logger driver is the implementation of thefactory, which holds the contextual instance information thatallows multiple loggers of the same type to perform differentactions, such as logging to different locations.
Index¶
- func AddBuiltinLogOpts(opts map[string]bool)
- func ListDrivers() []string
- func PutMessage(msg *Message)
- func RegisterExternalValidator(v LogOptValidator)
- func RegisterLogDriver(name string, c Creator) error
- func RegisterLogOptValidator(name string, l LogOptValidator) error
- func RegisterPluginGetter(g plugingetter.PluginGetter)
- func ValidateLogOpts(name string, cfg map[string]string) error
- type Capability
- type Copier
- type Creator
- type ErrReadLogsNotSupported
- type Info
- func (info *Info) Command() string
- func (info *Info) ExtraAttributes(keyMod func(string) string) (map[string]string, error)
- 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 LogOptValidator
- type LogReader
- type LogWatcher
- type Logger
- type Message
- type ReadConfig
- type SizedLogger
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcAddBuiltinLogOpts¶
AddBuiltinLogOpts updates the list of built-in log opts. This allows other packages to supplement additional log optionswithout having to register an actual log driver. This is used by things that are more proxy log drivers and shouldnot be exposed as a usable log driver to the API.This should only be called on package initialization.
funcPutMessage¶
func PutMessage(msg *Message)
PutMessage puts the specified message back n the message pool.The message fields are reset before putting into the pool.
funcRegisterExternalValidator¶
func RegisterExternalValidator(vLogOptValidator)
RegisterExternalValidator adds the validator to the list of external validators.External validators are used by packages outside this package that need to add their own validation logic.This should only be called on package initialization.
funcRegisterLogDriver¶
RegisterLogDriver registers the given logging driver builder with given loggingdriver name.
funcRegisterLogOptValidator¶
func RegisterLogOptValidator(namestring, lLogOptValidator)error
RegisterLogOptValidator registers the logging option validator withthe given logging driver name.
funcRegisterPluginGetter¶
func RegisterPluginGetter(gplugingetter.PluginGetter)
RegisterPluginGetter sets the plugingetter
Types¶
typeCapability¶
type Capability struct {// Determines if a log driver can read back logsReadLogsbool}Capability defines the list of capabilities that a driver can implementThese capabilities are not required to be a logging driver, however dodetermine how a logging driver can be used
typeCopier¶
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.
typeCreator¶
Creator builds a logging driver instance with given context.
funcGetLogDriver¶
GetLogDriver provides the logging driver builder for a logging driver name.
typeErrReadLogsNotSupported¶
type ErrReadLogsNotSupported struct{}ErrReadLogsNotSupported is returned when the underlying log driver does not support reading
func (ErrReadLogsNotSupported)Error¶
func (ErrReadLogsNotSupported) Error()string
func (ErrReadLogsNotSupported)NotImplemented¶
func (ErrReadLogsNotSupported) NotImplemented()
NotImplemented makes this error implement the `NotImplemented` interface from api/errdefs
typeInfo¶
type Info struct {Config map[string]stringContainerIDstringContainerNamestringContainerEntrypointstringContainerArgs []stringContainerImageIDstringContainerImageNamestringContainerCreatedtime.TimeContainerEnv []stringContainerLabels map[string]stringLogPathstringDaemonNamestring}Info provides enough information for a logging driver to do its function.
func (*Info)Command¶
Command returns the command that the container being logged wasstarted with. The Entrypoint is prepended to the containerarguments.
func (*Info)ExtraAttributes¶
ExtraAttributes returns the user-defined extra attributes (labels,environment variables) in key-value format. This can be used by log driversthat support metadata to add more context to a log.
func (*Info)ImageFullID¶
ImageFullID is an alias of ContainerImageID.
typeLogOptValidator¶
LogOptValidator checks the options specific to the underlyinglogging implementation.
typeLogReader¶
type LogReader interface {// ReadLogs reads logs from underlying logging backend.ReadLogs(context.Context,ReadConfig) *LogWatcher}LogReader is the interface for reading log messages for loggers that support reading.
typeLogWatcher¶
type LogWatcher struct {// For sending log messages to a reader.Msg chan *Message// For sending error messages that occur while reading logs.Err chanerror// contains filtered or unexported fields}LogWatcher is used when consuming logs read from the LogReader interface.
func (*LogWatcher)ConsumerGone¶
func (w *LogWatcher) ConsumerGone()
ConsumerGone notifies that the logs consumer is gone.
func (*LogWatcher)WatchConsumerGone¶
func (w *LogWatcher) WatchConsumerGone() <-chan struct{}
WatchConsumerGone returns a channel receiver that receives notificationwhen the log watcher consumer is gone.
typeMessage¶
type Messagebackend.LogMessage
Message is data structure that represents piece of output produced by somecontainer. The Line member is a slice of an array whose contents can bechanged after a log driver's Log() method returns.
Message is subtyped from backend.LogMessage because there is a lot ofinternal complexity around the Message type that should not be exposedto any package not explicitly importing the logger type.
funcNewMessage¶
func NewMessage() *Message
NewMessage returns a new message from the message sync.Pool
func (*Message)AsLogMessage¶
func (m *Message) AsLogMessage() *backend.LogMessage
AsLogMessage returns a pointer to the message as a pointer tobackend.LogMessage, which is an identical type with a different purpose
typeReadConfig¶
ReadConfig is the configuration passed into ReadLogs.
typeSizedLogger¶
SizedLogger is the interface for logging drivers that can controlthe size of buffer used for their messages.
Source Files¶
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 etwlogs provides a log driver for forwarding container logs as ETW events.(ETW stands for Event Tracing for Windows) A client can then create an ETW listener to listen for events that are sent by the ETW provider that we register, using the provider's GUID "a3693192-9ed6-46d2-a981-f8226c8363bd". | Package etwlogs provides a log driver for forwarding container logs as ETW events.(ETW stands for Event Tracing for Windows) A client can then create an ETW listener to listen for events that are sent by the ETW provider that we register, using the provider's GUID "a3693192-9ed6-46d2-a981-f8226c8363bd". |
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. |
internal | |
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. |
internal/export Package export implements a serializer for the systemd Journal Export Format as documented at https://systemd.io/JOURNAL_EXPORT_FORMATS/ | Package export implements a serializer for the systemd Journal Export Format as documented at https://systemd.io/JOURNAL_EXPORT_FORMATS/ |
internal/fake Package fake implements a journal writer for testing which is decoupled from the system's journald. | Package fake implements a journal writer for testing which is decoupled from the system's journald. |
internal/sdjournal Package sdjournal provides a Go interface to the systemd journal read API by wrapping the libsystemd C library. | Package sdjournal provides a Go interface to the systemd journal read API by wrapping the libsystemd C library. |
Package jsonfilelog provides the default Logger implementation for Docker logging. | Package jsonfilelog provides the default Logger implementation for Docker logging. |
Package local provides a logger implementation that stores logs on disk. | Package local provides a logger implementation that stores logs on disk. |
Package splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint. | Package splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint. |
Package syslog provides the logdriver for forwarding server logs to syslog endpoints. | Package syslog provides the logdriver for forwarding server logs to syslog endpoints. |