提交 5c5b03ea 作者: Steven Allen

Revert "Merge pull request #5708 from ipfs/fix/log-ndjson"

This reverts commit f0bf9936, reversing
changes made to d5c8fa50.

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 0d80fc54
......@@ -2,7 +2,6 @@ package commands
import (
"bytes"
"encoding/json"
"fmt"
"io"
......@@ -104,28 +103,13 @@ Outputs event log messages (not other log messages) as they are generated.
Run: func(req cmds.Request, res cmds.Response) {
ctx := req.Context()
r1, w1 := io.Pipe()
r2, w2 := io.Pipe()
r, w := io.Pipe()
go func() {
defer w1.Close()
defer w.Close()
<-ctx.Done()
}()
// Reformat the logs as ndjson
// TODO: remove this: #5709
go func() {
defer w2.Close()
decoder := json.NewDecoder(r1)
encoder := json.NewEncoder(w2)
for {
var obj interface{}
if decoder.Decode(&obj) != nil || encoder.Encode(obj) != nil {
return
}
}
}()
lwriter.WriterGroup.AddWriter(w1)
res.SetOutput(r2)
lwriter.WriterGroup.AddWriter(w)
res.SetOutput(r)
},
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论