Fix: Add conventions for Production vs Development log levels #466
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optic recently updated our version of mockttp, the latest of which comes with a known issue where an inner dependency uses a deprecated stream processor. While non-breaking, the node community has not been able to fully shift away from this deprecated functionality yet..
We want to make sure Optic contributors, and non-stable build users see every warning, because future warnings may indeed matter. But we also don't want to pollute production CLIs will warnings that those users don't need to worry about.
This PR starts looking for
OPTIC_DEVELOPMENT
in the environment. When you are developing Optic with thesourceme.sh
aliases on your path, that variable is present in the environment, the effect of which is that you see all warnings. When this is missing (production builds) you won't see the node deprecation warnings.There may well be other kinds of warnings we want to add to development only Optic builds, we will likely continue using
OPTIC_DEVELOPMENT
as the flag to turn this feedback on and off.We'll continue tracking the mockttp issue and hope to move away from the deprecated functionality the dependencies rely on soon.