diff --git a/catalyst-uploader.go b/catalyst-uploader.go index 465b3fb..629771f 100644 --- a/catalyst-uploader.go +++ b/catalyst-uploader.go @@ -20,6 +20,10 @@ func main() { } func run() int { + err := flag.Set("logtostderr", "true") + if err != nil { + glog.Fatal(err) + } // cmd line args describe := flag.Bool("j", false, "Describe supported storage services in JSON format and exit") timeout := flag.Duration("t", 30*time.Second, "Upload timeout") @@ -46,17 +50,19 @@ func run() int { return 1 } - err := core.Upload(os.Stdin, uri, WaitBetweenWrites, *timeout) + err = core.Upload(os.Stdin, uri, WaitBetweenWrites, *timeout) if err != nil { glog.Fatalf("Uploader failed for %s: %s", uri, err) return 1 } // success, write uploaded file details to stdout - err = json.NewEncoder(stdout).Encode(map[string]string{"uri": uri}) - if err != nil { - glog.Fatal(err) - return 1 + if glog.V(5) { + err = json.NewEncoder(stdout).Encode(map[string]string{"uri": uri}) + if err != nil { + glog.Fatal(err) + return 1 + } } return 0 diff --git a/catalyst-uploader_test.go b/catalyst-uploader_test.go index 7104bbd..52b7367 100644 --- a/catalyst-uploader_test.go +++ b/catalyst-uploader_test.go @@ -88,7 +88,7 @@ func TestFsHandlerE2E(t *testing.T) { defer os.Remove(outFileName) // run - uploader := exec.Command("go", "run", "catalyst-uploader.go", outFileName) + uploader := exec.Command("go", "run", "catalyst-uploader.go", "-v", "5", outFileName) uploader.Stdin = stdinReader stdoutRes, err := uploader.Output() require.NoError(t, err) diff --git a/go.mod b/go.mod index eadf0d5..c023463 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/golang/glog v1.1.0 github.com/google/uuid v1.3.0 - github.com/livepeer/go-tools v0.3.3 + github.com/livepeer/go-tools v0.3.4 github.com/stretchr/testify v1.8.4 ) diff --git a/go.sum b/go.sum index 16547a4..25168f0 100644 --- a/go.sum +++ b/go.sum @@ -1433,6 +1433,8 @@ github.com/livepeer/go-tools v0.3.2 h1:5pOUrOmkkGbbcWnpCt2yrSD6cD85G4GcpO4B25NpM github.com/livepeer/go-tools v0.3.2/go.mod h1:qs31y68b3PQPmSr8nR8l5WQiIWI623z6pqOccqebjos= github.com/livepeer/go-tools v0.3.3 h1:Je2P+ovDIIlFWtlns5v+MmHtdIytsAJS6+XyeZ8sFJI= github.com/livepeer/go-tools v0.3.3/go.mod h1:qs31y68b3PQPmSr8nR8l5WQiIWI623z6pqOccqebjos= +github.com/livepeer/go-tools v0.3.4 h1:Otl8VkGA5FdNQMTTN/yh0V72vhSbSQevUTL67AXz6kU= +github.com/livepeer/go-tools v0.3.4/go.mod h1:qs31y68b3PQPmSr8nR8l5WQiIWI623z6pqOccqebjos= github.com/lucas-clemente/quic-go v0.19.3/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8= github.com/lucas-clemente/quic-go v0.28.1/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0= github.com/lucas-clemente/quic-go v0.29.1/go.mod h1:CTcNfLYJS2UuRNB+zcNlgvkjBhxX6Hm3WUxxAQx2mgE=