GoogleCloudPlatform / gcr-cleaner

Delete untagged image refs in Google Container Registry or Artifact Registry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logger verbosity not respected

ventsislav-georgiev opened this issue · comments

TL;DR

Small request to use the logger in the main.go file in order to allow mute of the no refs deleted messages using the GCRCLEANER_LOG env var.

ref:

fmt.Fprintf(stdout, " ✗ no refs were deleted\n")

Hi @ventsislav-georgiev

Thank you for opening an issue. The CLI has to output information, and the logger only outputs structured logging (JSON). What is the use case for muting the output?

Hey, thanks for the quick reply.

I'm using the github action as specified here and want to limit the stdout output and print only errors.

Hi @ventsislav-georgiev

The structured logging is really about documenting exchanges with upstream APIs and gcr-cleaner's decision-making process. Errors are printed to stderr, so if you only want errors, you could redirect stdout to /dev/null.

@sethvargo Thanks! I actually didn't realize that the github actions example is running a docker image which just starts the CLI with the provided args. I'm used to the javascript actions and wasn't aware of the docker container ones.

@sethvargo I've just tested it. However, there is no shell in the container and without shell I can't use > /dev/null redirect. I could make a separate container for this use case but.. Any other suggestions?