flyctl
flyctl copied to clipboard
Add global `--debug` flag to enable debug logs (ala `LOG_LEVEL=debug`)
The debug logs are useful for diagnosing issues with the api, builds, remote builders, wireguard, etc. Unfortunately an env variable isn't discoverable so nobody knows about them. We should enable them from a common global flag that people already expect to help with debugging, like --debug, --verbose, --trace, etc.
We might also want to print a message on error instructing the user to try again with that flag.
Hopefully exposing debug logs will help folks figure out issues before heading to the forum or giving up.
Hey!
I tried to implement this, it was easier to add the global flag and bind it to viper. I am not sure how to access the flag value at places where LOG_LEVEL=debug env is accessed(i.e inside the /internal package and the /terminal package init) 😅
I think there's a mix of old and new commands and how flags are associated with the context/cmdcontext, not sure the way I approached in the draft PR is the right noe, any pointers to go in the right direction are highly appreciated! thanks
#2704 helps with this
@billyb2 does that PR achieve the same thing as LOG_LEVEL=debug? Or just sets that env variable?
It looks like there's already debug level logging via FLYCTL_OUTPUT_HAR here: https://github.com/superfly/flyctl/pull/2289 (undocumented)
But https://github.com/superfly/flyctl/issues/3107