How can I turn on DEBUG level logs in only this one module without turning on the whole system.
#define NRF_LOG_MODULE_NAME nrf_dfu_req_handler #include "nrf_log.h" NRF_LOG_MODULE_REGISTER();
Thanks
How can I turn on DEBUG level logs in only this one module without turning on the whole system.
#define NRF_LOG_MODULE_NAME nrf_dfu_req_handler #include "nrf_log.h" NRF_LOG_MODULE_REGISTER();
Thanks
Hello,
That is not possible, I am afraid. If you look at the definition for NRF_LOG_INTERNAL_MODULE:
#define NRF_LOG_INTERNAL_MODULE(level, level_id, ...) \
if (NRF_LOG_ENABLED && (NRF_LOG_LEVEL >= level) && \
(level <= NRF_LOG_DEFAULT_LEVEL)) \
{ \
if (NRF_LOG_FILTER >= level) \
{ \
LOG_INTERNAL(LOG_SEVERITY_MOD_ID(level_id), __VA_ARGS__); \
} \
}
You can see that it is printed if:
1: NRF_LOG_ENABLED (so you need to enable logging in general,
2: NRF_LOG_LEVEL >= level, where NRF_LOG_LEVEL is the module log level set in sdk_config.h (e.g. NRF_PWR_MGMT_CONFIG_LOG_LEVEL), and,
3: level <= NRF_LOG_DEFAULT_LEVEL, that is, the level you are printing (NRF_LOG_DEBUG()) is at least NRF_LOG_DEFAULT_LEVEL (from sdk_config.h).
So if you want to print only from debug from one module, you need to enable logging in general (NRF_LOG_ENABLED = 1), and you need to disable the other modules that are printing from sdk_config.h, and you need to set the log level for that module to "debug" (=4).
Best regards,
Edvin
Reading your question again, perhaps you want to see logs from other modules as well, but only debug from one module. Either way, you need to manually set the other log levels to not include debug, but NRF_LOG_DEFAULT_LEVEL needs to be set to 4, and so does the log level for the module that you want to see.
BR,
Edvin