diff options
author | Jon Bratseth <bratseth@oath.com> | 2021-09-29 15:28:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 15:28:07 +0200 |
commit | 1810b15d64a09d63789e7fe7218bcad01d85c73d (patch) | |
tree | cfa204d6d59d9d128e4851057459d50eca306d81 /client/go/cmd/query.go | |
parent | f94cfdb79cff470b2b3eb5314e7e9109f5110444 (diff) | |
parent | 9350b6ae83e6b87d28e258e33b9ff538213bc1d9 (diff) |
Merge pull request #19342 from vespa-engine/mpolden/vespa-log
Implement vespa log command
Diffstat (limited to 'client/go/cmd/query.go')
-rw-r--r-- | client/go/cmd/query.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/client/go/cmd/query.go b/client/go/cmd/query.go index f05914eb9a7..5e2b268865d 100644 --- a/client/go/cmd/query.go +++ b/client/go/cmd/query.go @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // vespa query command // author: bratseth @@ -47,7 +47,7 @@ func query(arguments []string) { response, err := service.Do(&http.Request{URL: url}, time.Second*10) if err != nil { - log.Print(color.Red("Error: "), "Request failed: ", err) + printErr(nil, "Request failed: ", err) return } defer response.Body.Close() @@ -55,11 +55,9 @@ func query(arguments []string) { if response.StatusCode == 200 { log.Print(util.ReaderToJSON(response.Body)) } else if response.StatusCode/100 == 4 { - log.Print(color.Red("Error: "), "Invalid query: ", response.Status, "\n") - log.Print(util.ReaderToJSON(response.Body)) + printErr(nil, "Invalid query: ", response.Status, "\n", util.ReaderToJSON(response.Body)) } else { - log.Print(color.Red("Error: "), response.Status, " from container at ", color.Cyan(url.Host), "\n") - log.Print(util.ReaderToJSON(response.Body)) + printErr(nil, response.Status, " from container at ", color.Cyan(url.Host), "\n", util.ReaderToJSON(response.Body)) } } |