Skip to content

Commit d98a90a

Browse files
committed
Update logging changes to not use new variable
1 parent e7a9ab4 commit d98a90a

1 file changed

Lines changed: 8 additions & 21 deletions

File tree

src/wp_logging.c

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,22 @@ static wolfProv_Logging_cb log_function = NULL;
4040
* wolfProv_Debugging_ON() and wolfProv_Debugging_OFF(). */
4141
static int loggingEnabled = 1;
4242

43-
#ifdef WOLFPROV_DEBUG_SILENT
44-
/* Silent mode gate - when active, blocks all logging output regardless of
45-
* loggingEnabled. Only deactivated when WOLFPROV_LOG_LEVEL or
46-
* WOLFPROV_LOG_COMPONENTS environment variables are set at runtime. */
47-
static int silentModeActive = 1;
48-
#endif
49-
5043
/* Logging level. Bitmask of logging levels in wolfProv_LogLevels.
5144
* Default log level includes error, enter/leave, and info. Does not turn on
5245
* verbose by default. */
46+
#ifdef WOLFPROV_DEBUG_SILENT
47+
static int providerLogLevel = 0;
48+
#else
5349
static int providerLogLevel = WP_LOG_LEVEL_ALL;
50+
#endif
5451

5552
/* Components which will be logged when debug enabled. Bitmask of components
5653
* in wolfProv_LogComponents. Default components include all. */
54+
#ifdef WOLFPROV_DEBUG_SILENT
55+
static int providerLogComponents = 0;
56+
#else
5757
static int providerLogComponents = WP_LOG_COMP_ALL;
58+
#endif
5859

5960
/* Callback functions to parse environment variables WOLFPROV_LOG_LEVEL and WOLFPROV_LOG_COMPONENTS */
6061
static void wolfProv_LogLevelToMask(const char* level, size_t len, void* ctx);
@@ -128,13 +129,6 @@ int wolfProv_LogInit(void)
128129
char* logLevelStr = XGETENV("WOLFPROV_LOG_LEVEL");
129130
char* logComponentsStr = XGETENV("WOLFPROV_LOG_COMPONENTS");
130131

131-
#ifdef WOLFPROV_DEBUG_SILENT
132-
/* In silent mode, deactivate the silent gate only if env vars are set */
133-
if (logLevelStr != NULL || logComponentsStr != NULL) {
134-
silentModeActive = 0;
135-
}
136-
#endif
137-
138132
if (logLevelStr != NULL) {
139133
if (wolfProv_TokenParse(logLevelStr, "()| \t", wolfProv_LogLevelToMask,
140134
&level) == 0) {
@@ -225,13 +219,6 @@ static void wolfprovider_log(const int component, const int logLevel,
225219
return;
226220
}
227221

228-
#ifdef WOLFPROV_DEBUG_SILENT
229-
/* In silent mode, block all output until env vars unlock it */
230-
if (silentModeActive) {
231-
return;
232-
}
233-
#endif
234-
235222
/* Don't log messages that do not match our current logging level */
236223
if ((providerLogLevel & logLevel) != logLevel) {
237224
return;

0 commit comments

Comments
 (0)