Skip to content
Snippets Groups Projects
Unverified Commit a07b5ccb authored by David's avatar David Committed by GitHub
Browse files

Merge pull request #459 from daixiang0/print-error-to-stderr

Log error to stderr
parents 894357bc 72b99243
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"time"
......@@ -48,7 +49,7 @@ func listLabelValues(name string) (*logproto.LabelResponse, error) {
func doRequest(path string, out interface{}) error {
url := *addr + path
fmt.Println(url)
log.Print(url)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
......
package main
import (
"fmt"
"log"
"os"
kingpin "gopkg.in/alecthomas/kingpin.v2"
......@@ -28,11 +28,12 @@ var (
)
func main() {
log.SetOutput(os.Stderr)
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case queryCmd.FullCommand():
if *addr == "" {
fmt.Println("Server address cannot be empty")
os.Exit(1)
log.Fatalln("Server address cannot be empty")
}
doQuery()
case labelsCmd.FullCommand():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment