Skip to content

Conversation

@ColtonWilley
Copy link
Contributor

By default the debug build is noisy with default logging options. This is not suitable for testing systems with many applications as the log pollution becomes a problem. Add option for debug output to default to silent, with option to enable level or component specific logging at runtime with environment variables.

/* Silent mode gate - when active, blocks all logging output regardless of
* loggingEnabled. Only deactivated when WOLFPROV_LOG_LEVEL or
* WOLFPROV_LOG_COMPONENTS environment variables are set at runtime. */
static int silentModeActive = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding yet another flag, can we just change the defaults for the existing flags? Eg:

#ifdef WOLFPROV_DEBUG_SILENT
static int providerLogLevel = 0;
static int providerLogComponents = 0;
#else
static int providerLogLevel = WP_LOG_LEVEL_ALL;
static int providerLogComponents = WP_LOG_COMP_ALL;
#endif

char logMessage[WOLFPROV_MAX_LOG_WIDTH];

/* Don't log if logging is disabled */
if (!loggingEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, good catch!

@padelsbach
Copy link
Contributor

Why do we need a special build for this? Why can't they use the env vars?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants