-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log: support for user defined log levels #3380
Conversation
This PR brings support for better log level handling. Terraform logs are already written in the form which https://github.com/hashicorp/logutils can understand easily. Based on this fact we know have the followings: * A new `TF_LOG_LEVEL` environment variable which the user can control * Users can pass levels in the form of "info", "Info" or "INFO" * If an invalid log level is passed, we print a warning but still continue * All changes are backwards compatible with the current logs
Thanks for working on this! It seems like it'd be very useful, since the existing logs are incredibly verbose. (I'm sure that this change would expose some cases where existing logs may be better changed to a new level, or have a level added; e.g. detecting your home directory is arguably no more than In terms of the "user-interface" for this, it seems a little awkward that a user must set both For compatibility with existing usage patterns the values How does that sound? |
You are right, I just wanted to break the functionality. Adding an option without touching the first one seems to be ok for me. But your approach is just fine and even better :) I'll update the PR with the changes. |
Having only one environment level makes it more easier to use.
I rebased this and merged it as 0090c06. Thanks for this. It should make debugging easier if we can hide all of those noisy |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This PR brings support for better log level handling. Terraform logs
are already written in the form which
https://github.com/hashicorp/logutils can understand easily. Based on
this fact we know have the followings:
TF_LOG_LEVEL
environment variable which the user can controlcontinue
Some pictures:
Without any changes:
With
TF_LOG_LEVEL=info
:With a wrong log level: