mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-06 09:16:17 +02:00
Add logging prefixes to api.c client and server
This commit is contained in:
+14
-1
@@ -127,6 +127,7 @@ THREAD_LS_T void *StackSizeCheck_stackOffsetPointer = 0;
|
||||
/* Set these to default values initially. */
|
||||
static wolfSSL_Logging_cb log_function = NULL;
|
||||
static int loggingEnabled = 0;
|
||||
THREAD_LS_T const char* log_prefix = NULL;
|
||||
|
||||
#if defined(WOLFSSL_APACHE_MYNEWT)
|
||||
#include "log/log.h"
|
||||
@@ -186,6 +187,15 @@ void wolfSSL_Debugging_OFF(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix)
|
||||
{
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
log_prefix = prefix;
|
||||
#else
|
||||
(void)prefix;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_FUNC_TIME
|
||||
/* WARNING: This code is only to be used for debugging performance.
|
||||
* The code is not thread-safe.
|
||||
@@ -316,7 +326,10 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
|
||||
defined(HAVE_STACK_SIZE_VERBOSE) && defined(HAVE_STACK_SIZE_VERBOSE_LOG)
|
||||
STACK_SIZE_CHECKPOINT_MSG(logMessage);
|
||||
#else
|
||||
fprintf(stderr, "%s\n", logMessage);
|
||||
if (log_prefix != NULL)
|
||||
fprintf(stderr, "[%s]: %s\n", log_prefix, logMessage);
|
||||
else
|
||||
fprintf(stderr, "%s\n", logMessage);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user