MCPcopy Index your code
hub / github.com/docker/docker-agent / Write

Method Write

pkg/logging/rotate.go:80–93  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

78}
79
80func (r *RotatingFile) Write(p []byte) (int, error) {
81 r.mu.Lock()
82 defer r.mu.Unlock()
83
84 if r.size+int64(len(p)) > r.maxSize {
85 if err := r.rotate(); err != nil {
86 return 0, err
87 }
88 }
89
90 n, err := r.file.Write(p)
91 r.size += int64(n)
92 return n, err
93}
94
95func (r *RotatingFile) Close() error {
96 r.mu.Lock()

Calls 3

rotateMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45