fix: import path should be github.com/ooni/probe-cli/v3 (#200)

See https://github.com/ooni/probe/issues/1335#issuecomment-771499511
This commit is contained in:
Simone Basso
2021-02-02 10:32:46 +01:00
committed by GitHub
parent faa9308b1e
commit b1ce300c8d
68 changed files with 86 additions and 85 deletions
@@ -0,0 +1,33 @@
package batch
import (
j "encoding/json"
"io"
"os"
"sync"
"github.com/apex/log"
)
// Default handler outputting to stderr.
var Default = New(os.Stderr)
// Handler implementation.
type Handler struct {
*j.Encoder
mu sync.Mutex
}
// New handler.
func New(w io.Writer) *Handler {
return &Handler{
Encoder: j.NewEncoder(w),
}
}
// HandleLog implements log.Handler.
func (h *Handler) HandleLog(e *log.Entry) error {
h.mu.Lock()
defer h.mu.Unlock()
return h.Encoder.Encode(e)
}