fix(ooniprobe): send batch output to stdout (#261)

Rationale explained in detail in a documentation comment.

Reference issue: https://github.com/ooni/probe/issues/1384.
This commit is contained in:
Simone Basso 2021-03-24 11:39:45 +01:00 committed by GitHub
parent fc19c9901a
commit 9c820cf855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -9,8 +9,17 @@ import (
"github.com/apex/log"
)
// Default handler outputting to stderr.
var Default = New(os.Stderr)
// Default handler outputting to stdout. We want to emit the batch
// output on the standard output, for two reasons:
//
// 1. because third party libraries MAY log on the stderr and
// their logs are most likely not JSON;
//
// 2. because this enables piping to `jq` or other tools in
// a much more natural way than when emitting on stderr.
//
// See https://github.com/ooni/probe/issues/1384.
var Default = New(os.Stdout)
// Handler implementation.
type Handler struct {

View File

@ -14,7 +14,7 @@ import (
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/utils"
)
// Default handler outputting to stderr.
// Default handler outputting to stdout.
var Default = New(os.Stdout)
// start time.