We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e971551 commit ebc1b17Copy full SHA for ebc1b17
1 file changed
intra/log/fconsole.go
@@ -1,12 +1,15 @@
1
package log
2
3
import (
4
+ "bytes"
5
"io"
6
"os"
7
"syscall"
8
"unsafe"
9
)
10
11
+var newline = []byte{'\n'}
12
+
13
type fconsole struct {
14
// takes ownership of w
15
w *os.File
@@ -65,6 +68,10 @@ func (f *fconsole) write(m Logmsg) error {
65
68
p := unsafe.StringData(m)
66
69
b := unsafe.Slice(p, len(m))
67
70
n, err := w.Write(b)
71
+ // go.dev/play/p/NbJimcpoS0o
72
+ if !bytes.HasSuffix(b, newline) {
73
+ w.Write(newline)
74
+ }
75
if err != nil {
76
if err == syscall.EAGAIN || err == syscall.EWOULDBLOCK || err == syscall.EINTR {
77
// non-blocking write would block; drop the log
0 commit comments