remote syslog: one Write() call per \n-terminated line
We don’t want newlines in individual remote syslog lines.
This commit is contained in:
parent
a4c823dc2b
commit
11dacf4264
@ -75,8 +75,11 @@ func (w *remoteSyslogWriter) Write(b []byte) (int, error) {
|
||||
w.lines.Write(b)
|
||||
w.syslogMu.Lock()
|
||||
defer w.syslogMu.Unlock()
|
||||
if w.syslog != nil {
|
||||
w.syslog.Write(b)
|
||||
if w.syslog == nil {
|
||||
return len(b), nil
|
||||
}
|
||||
for _, line := range strings.Split(strings.TrimSpace(string(b)), "\n") {
|
||||
w.syslog.Write([]byte(line + "\n"))
|
||||
}
|
||||
return len(b), nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user