Skip to content

Commit

Permalink
Revert "Merge pull request #5708 from ipfs/fix/log-ndjson"
Browse files Browse the repository at this point in the history
This reverts commit f0bf993, reversing
changes made to d5c8fa5.
  • Loading branch information
Stebalien committed Nov 3, 2018
1 parent 32b7abb commit b8abe5f
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions core/commands/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package commands

import (
"bytes"
"encoding/json"
"fmt"
"io"

Expand Down Expand Up @@ -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)
},
}

Expand Down

1 comment on commit b8abe5f

@GitCop
Copy link

@GitCop GitCop commented on b8abe5f Nov 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.