1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/logger/logger_test.go
Anusha Ragunathan 0b4b0a7b5d Improve partial message support in logger
Docker daemon has a 16K buffer for log messages. If a message length
exceeds 16K, it should be split by the logger and merged at the
endpoint.

This change adds `PartialLogMetaData` struct for enhanced partial support
- LastPartial (bool) : indicates if this is the last of all partials.
- ID (string)        : unique 32 bit ID. ID is same across all partials.
- Ordinal (int starts at 1) : indicates the position of msg in the series of partials.
Also, the timestamps across partials in the same.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
2018-04-11 13:26:28 -07:00

21 lines
448 B
Go

package logger // import "github.com/docker/docker/daemon/logger"
import (
"github.com/docker/docker/api/types/backend"
)
func (m *Message) copy() *Message {
msg := &Message{
Source: m.Source,
PLogMetaData: m.PLogMetaData,
Timestamp: m.Timestamp,
}
if m.Attrs != nil {
msg.Attrs = make([]backend.LogAttr, len(m.Attrs))
copy(msg.Attrs, m.Attrs)
}
msg.Line = append(make([]byte, 0, len(m.Line)), m.Line...)
return msg
}