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.

No longer necessary now that we've updated go-log.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
  • Loading branch information
Stebalien committed Nov 3, 2018
1 parent 6476324 commit 3e21757
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

0 comments on commit 3e21757

Please sign in to comment.