github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/daemon/logger/logger_test.go (about)

     1  package logger // import "github.com/docker/docker/daemon/logger"
     2  
     3  import (
     4  	"github.com/docker/docker/api/types/backend"
     5  )
     6  
     7  func (m *Message) copy() *Message {
     8  	msg := &Message{
     9  		Source:       m.Source,
    10  		PLogMetaData: m.PLogMetaData,
    11  		Timestamp:    m.Timestamp,
    12  	}
    13  
    14  	if m.Attrs != nil {
    15  		msg.Attrs = make([]backend.LogAttr, len(m.Attrs))
    16  		copy(msg.Attrs, m.Attrs)
    17  	}
    18  
    19  	msg.Line = append(make([]byte, 0, len(m.Line)), m.Line...)
    20  	return msg
    21  }