You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some scenarios, for example: when running tests, when it would be nice to elevate the logging level. In Stereoscope, Syft and Grype this is created using the discard.New() constructor and returns a logger which doesn't log anything.
When looking at a Grype test issue, it became clear that we could not enable this logging level for the tests without modifying the code. Additionally, since Syft and Grype have different logger packages, we couldn't set this up in a Grype log package's init() function, as this wouldn't be called all the time and Syft's logger would remain the discard.
It would be great if there was a new function, something like discard.NewWithEnvironmentOverride() that would check for the presence of a consistent environment variable, for example something reasonably difficult to accidentally set like ANCHORE_GO_LOGGER_DEV_TEST_LEVEL to set a logging level such that logging can be enabled during tests or by default.
The text was updated successfully, but these errors were encountered:
There are some scenarios, for example: when running tests, when it would be nice to elevate the logging level. In Stereoscope, Syft and Grype this is created using the
discard.New()
constructor and returns a logger which doesn't log anything.When looking at a Grype test issue, it became clear that we could not enable this logging level for the tests without modifying the code. Additionally, since Syft and Grype have different logger packages, we couldn't set this up in a Grype log package's
init()
function, as this wouldn't be called all the time and Syft's logger would remain thediscard
.It would be great if there was a new function, something like
discard.NewWithEnvironmentOverride()
that would check for the presence of a consistent environment variable, for example something reasonably difficult to accidentally set likeANCHORE_GO_LOGGER_DEV_TEST_LEVEL
to set a logging level such that logging can be enabled during tests or by default.The text was updated successfully, but these errors were encountered: