Skip to content

Commit

Permalink
Switch success line to glog
Browse files Browse the repository at this point in the history
Also bump go-tools (reduced logging) and set logtostderr, glog.Info lines didn't show otherwise
  • Loading branch information
mjh1 committed Jan 5, 2024
1 parent 4569d5c commit a76892a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 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 @@ -37,7 +41,6 @@ func run() int {
}

// replace stdout to prevent any lib from writing debug output there
stdout := os.Stdout
os.Stdout, _ = os.Open(os.DevNull)

uri := flag.Arg(0)
Expand All @@ -46,17 +49,20 @@ 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) {
b, err := json.Marshal(map[string]string{"uri": uri})
if err != nil {
glog.Fatal(err)
return 1
}
glog.Info(string(b))
}

return 0
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 a76892a

Please sign in to comment.