Skip to content

Commit

Permalink
[MXCHIP] force all debug log for debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
mxchipwanges committed Mar 13, 2024
1 parent cb4daf3 commit d727268
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/supplemental/nanolib/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,11 @@ log_log(int level, const char *file, int line, const char *func,

for (int i = 0; i < MAX_CALLBACKS && L.callbacks[i].fn; i++) {
log_callback *cb = &L.callbacks[i];
#ifdef CONFIG_MXCHIP_FORCE_DEBUG_LOG
if(1) { // enable all log
#else
if (level <= cb->level) {
#endif
init_event(&ev, cb->udata, cb->config);
va_start(ev.ap, fmt);
if (cb->mtx == NULL) {
Expand Down
8 changes: 8 additions & 0 deletions src/supplemental/tls/mbedtls/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ mbedtls_log_level_to_nanomq(int log_level)

void mbedtls_log_level_update(int log_level)
{
#ifdef CONFIG_MXCHIP_FORCE_DEBUG_LOG
mbedtls_debug_set_threshold(4);
#else
mbedtls_debug_set_threshold(nanomq_log_level_to_mbedtls(log_level));
#endif
return;
}
#endif
Expand Down Expand Up @@ -723,8 +727,12 @@ nng_tls_engine_init_mbed(void)
nni_mtx_init(&ssl_conn_lock);

#ifdef CONFIG_MXCHIP_DEBUG_TLS
#ifdef CONFIG_MXCHIP_FORCE_DEBUG_LOG
mbedtls_debug_set_threshold(4); // enable all log
#else
// mbedtls log level read from nanomq conf
mbedtls_debug_set_threshold(nanomq_log_level_to_mbedtls(log_get_level()));
#endif

#else
// Uncomment the following to have noisy debug from mbedTLS.
Expand Down

0 comments on commit d727268

Please sign in to comment.