Improve logging and error handling @aknysh (#1358)
what
-
Improve logging
- Remove the deprecated logs functions throughout the codebase
- Only use the structured log functions (
log.Info
,log.Debug
,log.Warn
)
-
Improve error handling
- Add a new Go package
errors
with all functions and data structures related to error handling in the codebase (all other packages import theerrors
package and call its functions) - Remove all functions from the codebase that would exit the program execution earlier:
panic()
,log.Fatal()
,os.Exit()
, and some old Atmos error handling functions - In the new
errors
package, add a function to print errors in Markdown format (if Markdown is configured and TTY is supported), and a function to print errors and exit the program execution
- Add a new Go package
-
Don't process Atmos YAML functions and Go templates in
atmos validate stacks
why
-
Improve logging
- Standardize logs
- Make it easy to parse and analyze by log aggregators, SIEM tools, or monitoring systems
- Easier integration with tracing/Telemetry
- Consistency across logs
- Better debugging and contextual info
- Improved querying and filtering
-
Improve error handling
- Better, standard UI/UX
- All errors and program exits are handled in just one place, allowing easily configuring the look and feel of all error messages, and adding hooks for Tracing/Telemetry with just a few lines of code/config
- All early exits from any functions in the codebase (due to errors or other conditions) are now funneled through just one function in the
errors
package, allowing easier controlling the code execution and exit behavior
-
Don't process Atmos YAML functions and Go templates in
atmos validate stacks
. YAML functions and Go templates can access backends and clouds, butatmos validate stacks
should not require authentication and assuming roles
test
atmos terraform apply --affected --all --dry-run
atmos terraform apply component-1 -s nonprods
atmos terraform apply component-2 -s prod
atmos terraform apply component-1 -s nonprod
atmos terraform apply --all --logs-level=Debu
Add pager to `atmos describe dependents` command @samtholiya (#1295)
what
- Add pager to
atmos describe dependents
command
why
- Helps to view the dependents better in case of large dependents list
Update help with pager @samtholiya (#1276)
what
- Updated help with pager
why
- Makes easier for users to view the content
Add `--format` flag to `atmos version` command @samtholiya (#1322)
what
- Use different output formats: plain text, JSON, or YAML
why
- Required for automation