andyfeller/gh-dependency-report

Add support for verbose logging flag

Closed this issue · 2 comments

During the prototyping of the gh-dependency-report extension and learning the https://github.com/uber-go/zap library, logging was implemented using DEBUG as the default logging level. This can be a bit noisy if someone doesn't want that much detail, so we're going to change the default logging level to INFO with the option via -v, --verbose to lower it back to DEBUG.

andyfeller@Andrews-MacBook-Pro:andyfeller/gh-dependency-report ‹main*›$ go run main.go           
Error: requires at least 1 arg(s), only received 0
Usage:
  gh-dependency-report [flags] owner [repo ...]

Flags:
  -e, --exclude strings      Repositories to exclude from report
  -h, --help                 help for gh-dependency-report
  -o, --output-file string   Name of file to write CSV report, defaults to stdout

exit status 1
andyfeller@Andrews-MacBook-Pro:andyfeller/gh-dependency-report ‹main*›$ go run main.go andyfeller
2022-01-28T08:15:43.465-0500	INFO	cmd/root.go:80	Processing repos: [andyfeller argo-cd argo-helm argocd-notifications bespoke branch-protection-enforcer-app chef codeql-action-configs docker-alpine-abuild docker.github.io docs dotfiles fabric8-pipeline-library gh-dependency-report integrations-core jenkins-openshift-login-plugin jenkins-pipeline-library linux mockserver my-py-grpc-repo openshift-cassandra openshift-sync-plugin populate-project powershell-poc private-stack python stacks-experiment]
2022-01-28T08:15:43.465-0500	DEBUG	cmd/root.go:122	Processing andyfeller/andyfeller
2022-01-28T08:15:43.607-0500	DEBUG	cmd/root.go:122	Processing andyfeller/argo-cd
2022-01-28T08:15:43.737-0500	DEBUG	cmd/root.go:122	Processing andyfeller/argo-helm
2022-01-28T08:15:43.869-0500	DEBUG	cmd/root.go:122	Processing andyfeller/argocd-notifications
2022-01-28T08:15:44.030-0500	DEBUG	cmd/root.go:122	Processing andyfeller/bespoke
2022-01-28T08:15:44.560-0500	DEBUG	cmd/root.go:143	Processing andyfeller/bespoke > .github/workflows/init.yml
2022-01-28T08:15:44.778-0500	DEBUG	cmd/root.go:154	Processing andyfeller/bespoke > .github/workflows/init.yml > actions/checkout
2022-01-28T08:15:44.778-0500	DEBUG	cmd/root.go:143	Processing andyfeller/bespoke > .github/actions/populate_project/package-lock.json

Looking into the complexity around some of the examples of https://pkg.go.dev/go.uber.org/zap#hdr-Configuring_Zap, I decided to go with a somewhat simple solution as I don't want to overly complicate things:

Generate report of repository manifests and dependencies discovered through the dependency graph

Usage:
  gh-dependency-report [flags] owner [repo ...]

Flags:
      --debug                Whether to include debugging output
  -e, --exclude strings      Repositories to exclude from report
  -h, --help                 help for gh-dependency-report
  -o, --output-file string   Name of file to write CSV report, defaults to stdout

Basically, a simple flag with limited impact on the log level; either info or debug.

I made a grave mistake thinking this was closed in the linked PR above; that was solely for #2 , so I've reopened this as v0.2.0 only fixes the output file