1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 type LogPrefixer struct {
18 func (lp *LogPrefixer) Write(p []byte) (int, error) {
24 out = append(out, lp.Prefix...)
26 lp.did = p[len(p)-1] != '\n'
27 out = append(out, bytes.Replace(p[:len(p)-1], []byte("\n"), append([]byte("\n"), lp.Prefix...), -1)...)
28 out = append(out, p[len(p)-1])
29 _, err := lp.Writer.Write(out)