blob: 3b2ede3d3d6bbee94c0de6c98e84e6fcf3c3f3b7 [file] [log] [blame]
/*
* Copyright (c) 2018 Nordic Semiconductor ASA
* Copyright (c) 2022 Marcin Niestroj
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(mbedtls, CONFIG_MBEDTLS_LOG_LEVEL);
#include "zephyr_mbedtls_priv.h"
void zephyr_mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str)
{
const char *p, *basename = file;
ARG_UNUSED(ctx);
if (!file || !str) {
return;
}
/* Extract basename from file */
if (IS_ENABLED(CONFIG_MBEDTLS_DEBUG_EXTRACT_BASENAME_AT_RUNTIME)) {
for (p = basename = file; *p != '\0'; p++) {
if (*p == '/' || *p == '\\') {
basename = p + 1;
}
}
}
LOG_DBG("%s:%04d: |%d| %s", basename, line, level, str);
}