print everything that is not tweets to stderr (excluding wipe)

This commit is contained in:
gutmet 2020-10-21 08:34:11 +02:00
parent 7c56ae13e6
commit 50440290b8
2 changed files with 6 additions and 6 deletions

View File

@ -56,8 +56,8 @@ func createAppDir(appDir string) {
optLogFatal("createAppDir", err) optLogFatal("createAppDir", err)
return a return a
} }
fmt.Println("Did not find " + appDir + ", creating.") fmt.Fprintln(os.Stderr, "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, "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) err := os.MkdirAll(appDir, 0755)
optLogFatal("createAppDir", err) optLogFatal("createAppDir", err)
ck := ask("Consumer Key/API Key") ck := ask("Consumer Key/API Key")

View File

@ -114,7 +114,7 @@ func appendFileChunks(file string, media string, mediaId ObjectID) {
log := func(err error) { optLogFatal("appendFileChunks", err) } log := func(err error) { optLogFatal("appendFileChunks", err) }
info := func(v ...interface{}) { info := func(v ...interface{}) {
if len(media) > CHUNK_SIZE { if len(media) > CHUNK_SIZE {
fmt.Println(v...) fmt.Fprintln(os.Stderr, v...)
} }
} }
info("chunk upload", file) info("chunk upload", file)
@ -149,7 +149,7 @@ func finalizeFileUpload(file string, mediaId ObjectID) int64 {
log(err) log(err)
log(errors.New(finalizeResponse.Error)) log(errors.New(finalizeResponse.Error))
if id := ObjectID(finalizeResponse.Media_id_string); id != "" { 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 procInfo := finalizeResponse.Processing_info
return procInfo.Check_after_secs return procInfo.Check_after_secs
} else { } else {
@ -159,7 +159,7 @@ func finalizeFileUpload(file string, mediaId ObjectID) int64 {
} }
func wait(seconds int64) { func wait(seconds int64) {
fmt.Println("Waiting", seconds, "seconds") fmt.Fprintln(os.Stderr, "Waiting", seconds, "seconds")
time.Sleep(time.Duration(seconds) * time.Second) time.Sleep(time.Duration(seconds) * time.Second)
} }
@ -181,7 +181,7 @@ func pollStatus(mediaId ObjectID) {
} else if state == "failed" { } else if state == "failed" {
break break
} else { } else {
fmt.Println("Processing progress: ", procInfo.Progress_percent, "%") fmt.Fprintln(os.Stderr, "Processing progress: ", procInfo.Progress_percent, "%")
seconds := procInfo.Check_after_secs seconds := procInfo.Check_after_secs
if seconds > 10 { if seconds > 10 {
seconds = 10 seconds = 10