From 50440290b832f864727828c89327581d724b9d0d Mon Sep 17 00:00:00 2001 From: gutmet Date: Wed, 21 Oct 2020 08:34:11 +0200 Subject: [PATCH] print everything that is not tweets to stderr (excluding wipe) --- credentials.go | 4 ++-- media.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/credentials.go b/credentials.go index 2dcc034..7df20ba 100644 --- a/credentials.go +++ b/credentials.go @@ -56,8 +56,8 @@ func createAppDir(appDir string) { optLogFatal("createAppDir", err) return a } - fmt.Println("Did not find " + appDir + ", creating.") - fmt.Println("Go to " + registerAppURL + " to register a developer account, register a new app and generate access tokens with read & write permissions\n") + fmt.Fprintln(os.Stderr, "Did not find "+appDir+", creating.") + fmt.Fprintln(os.Stderr, "Go to "+registerAppURL+" to register a developer account, register a new app and generate access tokens with read & write permissions\n") err := os.MkdirAll(appDir, 0755) optLogFatal("createAppDir", err) ck := ask("Consumer Key/API Key") diff --git a/media.go b/media.go index 89f014f..fef28ae 100644 --- a/media.go +++ b/media.go @@ -114,7 +114,7 @@ func appendFileChunks(file string, media string, mediaId ObjectID) { log := func(err error) { optLogFatal("appendFileChunks", err) } info := func(v ...interface{}) { if len(media) > CHUNK_SIZE { - fmt.Println(v...) + fmt.Fprintln(os.Stderr, v...) } } info("chunk upload", file) @@ -149,7 +149,7 @@ func finalizeFileUpload(file string, mediaId ObjectID) int64 { log(err) log(errors.New(finalizeResponse.Error)) if id := ObjectID(finalizeResponse.Media_id_string); id != "" { - fmt.Println("==> Uploaded " + file + " with id " + string(id)) + fmt.Fprintln(os.Stderr, "==> Uploaded "+file+" with id "+string(id)) procInfo := finalizeResponse.Processing_info return procInfo.Check_after_secs } else { @@ -159,7 +159,7 @@ func finalizeFileUpload(file string, mediaId ObjectID) int64 { } func wait(seconds int64) { - fmt.Println("Waiting", seconds, "seconds") + fmt.Fprintln(os.Stderr, "Waiting", seconds, "seconds") time.Sleep(time.Duration(seconds) * time.Second) } @@ -181,7 +181,7 @@ func pollStatus(mediaId ObjectID) { } else if state == "failed" { break } else { - fmt.Println("Processing progress: ", procInfo.Progress_percent, "%") + fmt.Fprintln(os.Stderr, "Processing progress: ", procInfo.Progress_percent, "%") seconds := procInfo.Check_after_secs if seconds > 10 { seconds = 10