I was digging around a bit in my code to get a better grip on logging. In sdk_config.h, I have the following relevant settings:
#define NRF_LOG 1 #define NRF_LOG_ENABLED 1 #define NRF_LOG_DEFAULT_LEVEL 3 // <0=> Off, <1=> Error, <2=> Warning, <3=> Info , <4=> Debug
My modules all implement their own logging, i.e.:
#define NRF_LOG_MODULE_NAME calibration #if P2W_CALIB_CONFIG_LOG_ENABLED #define NRF_LOG_LEVEL P2W_CALIB_CONFIG_LOG_LEVEL #define NRF_LOG_INFO_COLOR P2W_CALIB_CONFIG_INFO_COLOR #define NRF_LOG_DEBUG_COLOR P2W_CALIB_CONFIG_DEBUG_COLOR #else // P2W_CALIB_CONFIG_LOG_ENABLED #define NRF_LOG_LEVEL 0 #endif // P2W_CALIB_CONFIG_LOG_ENABLED #include "nrf_log.h" NRF_LOG_MODULE_REGISTER();
Okay, that works. However, I'm also using a couple of modules that are delivered by 3rd parties that do not define their own module but simply rely on the default. I thought these are controlled by NRF_LOG_DEFAULT_LEVEL, but when I set this to 0, it disables *all* logging modules instead of just the ones that fall back to the default.
Is this a bug? If not, how do I disable logging for modules that do not provide module-specific NRF_LOG_LEVEL macro's but keep log settings for the ones that do?