[BUG] Inconsistent Log Formatting In Commands
Bug Report Template
Runtime Information
Please provide the following details about your environment:
Operating System (OS) | Architecture | Shell | Installation Method | bbctl Version |
---|---|---|---|---|
MacOS Sonoma 14.6.1 | arm64 | zsh | go install | v1.4.1 |
Steps to Reproduce
Please describe the steps needed to reproduce the bug:
- Update bbctl config file to set the following logger settings
- bbctl-log-format: text
- bbctl-log-level: debug
- Run a bbctl command, preferably one that will fail with an error
- I ran
bbctl list
with local cluster config when the local cluster was not running (see below)
- See inconsistent log formatting between the logs and the TEXT format set in the config
Expected Behavior
- Expected that the error log after the command uses the TEXT formatting
Actual Behavior
- Error log after the command uses JSON formatting:
$ bbctl list
time=2025-07-11T09:55:33.669-04:00 level=DEBUG msg="Logger setup complete"
time=2025-07-11T09:55:33.669-04:00 level=DEBUG msg="Command line settings: {<removed>}"
{"time":"2025-07-11T09:55:33.66998-04:00","level":"WARN","source":{"function":"main.injectableMain.func1","file":"/Users/ryandaily/projects/tools/bbctl/main.go","line":187},"msg":"Please update the configuration file to the latest version of bbctl by running: 'bbctl config init' ( Current Version: v1.4.1 | Config Version: 1.3.0 )"}
Error: error getting helm releases in namespace bigbang: Kubernetes cluster unreachable: Get "https://127.0.0.1:6443/version": dial tcp 127.0.0.1:6443: connect: connection refused
Usage:
bbctl list [flags]
Examples:
# Get a list of helm releases in bigbang namespace
# (equivalent of helm -n bigbang ls)
bbctl list
<abbreviated help message>
{"time":"2025-07-11T09:55:33.671362-04:00","level":"ERROR","source":{"function":"main.injectableMain","file":"/Users/ryandaily/projects/tools/bbctl/main.go","line":224},"msg":"error executing command: error getting helm releases in namespace bigbang: Kubernetes cluster unreachable: Get \"https://127.0.0.1:6443/version\": dial tcp 127.0.0.1:6443: connect: connection refused"}
Additional Context
As pointed out in a config related MR, there is an init Logger which can only use the JSON format.
This Logger should ONLY be used in main.go before the config file is read. Once the config file is parsed, the app needs to create a logger using the specified log format and the entire application needs to use that logger instead.