mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Add logging prefixes to api.c client and server
This commit is contained in:
@ -6152,6 +6152,8 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
|
|||||||
size_t msg_len = 0;
|
size_t msg_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wolfSSL_SetLoggingPrefix("server");
|
||||||
|
|
||||||
#ifdef WOLFSSL_TIRTOS
|
#ifdef WOLFSSL_TIRTOS
|
||||||
fdOpenSession(Task_self());
|
fdOpenSession(Task_self());
|
||||||
#endif
|
#endif
|
||||||
@ -6442,6 +6444,8 @@ done:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wolfSSL_SetLoggingPrefix(NULL);
|
||||||
|
|
||||||
#ifndef WOLFSSL_TIRTOS
|
#ifndef WOLFSSL_TIRTOS
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
@ -6688,6 +6692,8 @@ static int test_client_nofail(void* args, cbType cb)
|
|||||||
int doUdp = 0;
|
int doUdp = 0;
|
||||||
const char* cipherName1, *cipherName2;
|
const char* cipherName1, *cipherName2;
|
||||||
|
|
||||||
|
wolfSSL_SetLoggingPrefix("client");
|
||||||
|
|
||||||
#ifdef WOLFSSL_TIRTOS
|
#ifdef WOLFSSL_TIRTOS
|
||||||
fdOpenSession(Task_self());
|
fdOpenSession(Task_self());
|
||||||
#endif
|
#endif
|
||||||
@ -6907,6 +6913,9 @@ done:
|
|||||||
(void)args;
|
(void)args;
|
||||||
(void)cb;
|
(void)cb;
|
||||||
#endif /* !NO_WOLFSSL_CLIENT */
|
#endif /* !NO_WOLFSSL_CLIENT */
|
||||||
|
|
||||||
|
wolfSSL_SetLoggingPrefix(NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ THREAD_LS_T void *StackSizeCheck_stackOffsetPointer = 0;
|
|||||||
/* Set these to default values initially. */
|
/* Set these to default values initially. */
|
||||||
static wolfSSL_Logging_cb log_function = NULL;
|
static wolfSSL_Logging_cb log_function = NULL;
|
||||||
static int loggingEnabled = 0;
|
static int loggingEnabled = 0;
|
||||||
|
THREAD_LS_T const char* log_prefix = NULL;
|
||||||
|
|
||||||
#if defined(WOLFSSL_APACHE_MYNEWT)
|
#if defined(WOLFSSL_APACHE_MYNEWT)
|
||||||
#include "log/log.h"
|
#include "log/log.h"
|
||||||
@ -186,6 +187,15 @@ void wolfSSL_Debugging_OFF(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_WOLFSSL
|
||||||
|
log_prefix = prefix;
|
||||||
|
#else
|
||||||
|
(void)prefix;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_FUNC_TIME
|
#ifdef WOLFSSL_FUNC_TIME
|
||||||
/* WARNING: This code is only to be used for debugging performance.
|
/* WARNING: This code is only to be used for debugging performance.
|
||||||
* The code is not thread-safe.
|
* 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)
|
defined(HAVE_STACK_SIZE_VERBOSE) && defined(HAVE_STACK_SIZE_VERBOSE_LOG)
|
||||||
STACK_SIZE_CHECKPOINT_MSG(logMessage);
|
STACK_SIZE_CHECKPOINT_MSG(logMessage);
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ WOLFSSL_API int wolfSSL_Debugging_ON(void);
|
|||||||
/* turn logging off */
|
/* turn logging off */
|
||||||
WOLFSSL_API void wolfSSL_Debugging_OFF(void);
|
WOLFSSL_API void wolfSSL_Debugging_OFF(void);
|
||||||
|
|
||||||
|
WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix);
|
||||||
|
|
||||||
#ifdef HAVE_WC_INTROSPECTION
|
#ifdef HAVE_WC_INTROSPECTION
|
||||||
WOLFSSL_API const char *wolfSSL_configure_args(void);
|
WOLFSSL_API const char *wolfSSL_configure_args(void);
|
||||||
WOLFSSL_API const char *wolfSSL_global_cflags(void);
|
WOLFSSL_API const char *wolfSSL_global_cflags(void);
|
||||||
|
Reference in New Issue
Block a user