Skip to content

Commit c468778

Browse files
committed
ignore empty lines in prefixed writer
1 parent 158415c commit c468778

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

prefixed_writer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ func NewPrefixedWriter(w io.Writer, prefix string) *PrefixedWriter {
2020

2121
func (w *PrefixedWriter) Write(p []byte) (int, error) {
2222
for line := range bytes.SplitSeq(p, nl) {
23+
if len(line) == 0 {
24+
continue
25+
}
26+
2327
msg := make([]byte, len(line)+len(w.prefix)+len(nl))
2428
msg = append(msg, w.prefix...)
2529
msg = append(msg, line...)

0 commit comments

Comments
 (0)