fgeller/kt

Quiet mode to avoid printing informational messages to stderr

nzbart opened this issue · 6 comments

When scripting in a loop, the informational output to stderr can be quite noisy:

found 1 brokers
found 22 groups
found 1 topics
...

An example of the code that outputs this information is here, and it doesn't appear to allow for any kind of switch to turn it off:

kt/group.go

Line 66 in 6ba2d6d

fmt.Fprintf(os.Stderr, "found %v brokers\n", len(brokers))

Is it possible to add a -quiet flag that would stop outputting informational messages to stderr? This flag would not disable errors from being output to stderr.

hi @nzbart !
thanks for the feedback. i've drafted a version for the group command that changes the default to require the -verbose flag to print that additional information on the 130-logging branch in case you want to check it out. i'll port it to the other commands before i pull it into master.

@fgeller I'm working on Windows and using the Docker image, so I'll need to figure out how to build this in a container using https://github.com/Paxa/kt and get back to you.

hi @nzbart i pushed the changes to master - so you should be able to rebuild the docker image in the normal way. closing this optimistically for now, please re-open if you encounter any issues - thanks!

@fgeller I was hoping that a new container image would be built since this image is referenced in your readme, but the most recent image is from 2018.

docker run evpavel/kt ls -l /usr/bin/kt
-rwxr-xr-x    1 root     root       8425923 Nov 13  2018 /usr/bin/kt

It might be worth removing this from your readme if this image is no longer being updated.

kt/README.md

Lines 223 to 227 in 834c585

### Docker
[@Paxa](https://github.com/Paxa) maintains an image to run kt in a Docker environment - thanks!
For more information: [https://github.com/Paxa/kt](https://github.com/Paxa/kt)

@nzbart can you build the image yourself? i have no experience with windows to help, sorry. i created a version of paxa's files that will allow you to build a docker image against the current master version of kt: https://github.com/fgeller/docker-kt/tree/dep-master

@fgeller Windows can build and run Linux containers, so I have done that. However, I'm still getting the output when I don't use -verbose:

D:\dev\docker-kt [master ≡]> git log -1
commit 9172e3b41d8d5fe291414e54ee64b688bc175e16 (HEAD -> master, origin/master, origin/HEAD)
Author: Felix Geller <fgeller@protonmail.com>
Date:   Tue Aug 16 00:33:36 2022 +0200

    updates images and go installation
D:\dev\docker-kt [master ≡]> docker build --pull -t test . --quiet
sha256:77ef95975d734824107c74f4b4e5083c2963b607c5f77a9dd561434d53a1779e
D:\dev\docker-kt [master ≡]> docker run test kt group -brokers <redacted> -topic <redacted> | Out-Null
found 1 brokers
found 11 groups
found 1 topics
found partitions=[0] for topic=<redacted>