Vendor integration dependencies.

This commit is contained in:
Timo Reimann 2017-02-07 22:33:23 +01:00
parent dd5e3fba01
commit 55b57c736b
2451 changed files with 731611 additions and 0 deletions

View file

@ -0,0 +1,18 @@
package logger
// NullLogger is a logger.Logger and logger.Factory implementation that does nothing.
type NullLogger struct {
}
// Out is a no-op function.
func (n *NullLogger) Out(_ []byte) {
}
// Err is a no-op function.
func (n *NullLogger) Err(_ []byte) {
}
// Create implements logger.Factory and returns a NullLogger.
func (n *NullLogger) Create(_ string) Logger {
return &NullLogger{}
}

View file

@ -0,0 +1,29 @@
package logger
// Factory defines methods a factory should implement, to create a Logger
// based on the specified name.
type Factory interface {
Create(name string) Logger
}
// Logger defines methods to implement for being a logger.
type Logger interface {
Out(bytes []byte)
Err(bytes []byte)
}
// Wrapper is a wrapper around Logger that implements the Writer interface,
// mainly use by docker/pkg/stdcopy functions.
type Wrapper struct {
Err bool
Logger Logger
}
func (l *Wrapper) Write(bytes []byte) (int, error) {
if l.Err {
l.Logger.Err(bytes)
} else {
l.Logger.Out(bytes)
}
return len(bytes), nil
}