Skip to content

Commit

Permalink
Switch success line to glog (#49)
Browse files Browse the repository at this point in the history
* Switch success line to glog

Also bump go-tools (reduced logging) and set logtostderr, glog.Info lines didn't show otherwise

* fix
  • Loading branch information
mjh1 authored Jan 9, 2024
1 parent 4569d5c commit 8043ee0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
16 changes: 11 additions & 5 deletions catalyst-uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion catalyst-uploader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 8043ee0

Please sign in to comment.