mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
3a8728b431
- noplog driver pkg for '--log-driver=none' (null object pattern) - centralized factory for log drivers (instead of case/switch) - logging drivers registers themselves to factory upon import (easy plug/unplug of drivers in daemon/logdrivers.go) - daemon now doesn't start with an invalid log driver - Name() method of loggers is actually now their cli names (made it useful) - generalized Read() logic, made it unsupported except json-file (preserves existing behavior) Spotted some duplication code around processing of legacy json-file format, didn't touch that and refactored in both places. Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
25 lines
483 B
Go
25 lines
483 B
Go
package logger
|
|
|
|
import (
|
|
"errors"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
var ReadLogsNotSupported = errors.New("configured logging reader does not support reading")
|
|
|
|
// Message is datastructure that represents record from some container
|
|
type Message struct {
|
|
ContainerID string
|
|
Line []byte
|
|
Source string
|
|
Timestamp time.Time
|
|
}
|
|
|
|
// Logger is interface for docker logging drivers
|
|
type Logger interface {
|
|
Log(*Message) error
|
|
Name() string
|
|
Close() error
|
|
GetReader() (io.Reader, error)
|
|
}
|