Logging plugins use the same HTTP interface as other plugins for basic
command operations meanwhile actual logging operations are handled (on
Unix) via a fifo.
The plugin interface looks like so:
```go
type loggingPlugin interface {
StartLogging(fifoPath string, loggingContext Context) error
StopLogging(fifoPath)
```
This means a plugin must implement `LoggingDriver.StartLogging` and
`LoggingDriver.StopLogging` endpoints and be able to consume the passed
in fifo.
Logs are sent via stream encoder to the fifo encoded with protobuf.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 27bd6842f8518780b99fdb42f8e7f84c17856d87
Component: engine
20 lines
352 B
Go
20 lines
352 B
Go
package logger
|
|
|
|
func (m *Message) copy() *Message {
|
|
msg := &Message{
|
|
Source: m.Source,
|
|
Partial: m.Partial,
|
|
Timestamp: m.Timestamp,
|
|
}
|
|
|
|
if m.Attrs != nil {
|
|
msg.Attrs = make(map[string]string, len(m.Attrs))
|
|
for k, v := range m.Attrs {
|
|
msg.Attrs[k] = v
|
|
}
|
|
}
|
|
|
|
msg.Line = append(make([]byte, 0, len(m.Line)), m.Line...)
|
|
return msg
|
|
}
|