Configurable log levels for all the modules using Zephyr's logging.

This allows us to enable e.g debug output for the CAN module with
CONFIG_CAN_LOG_LEVEL=4 without enabling the global
CONFIG_LOG_DEFAULT_LEVEL=4 and being swamped with debug output from
all of Zephyr's subsytems.
This commit is contained in:
Daniel Fanache
2020-12-13 11:06:02 +01:00
committed by Martin Jäger
parent 755e555611
commit 9ba540ec8c
8 changed files with 61 additions and 8 deletions
+2 -2
View File
@@ -12,7 +12,7 @@
#include <drivers/gpio.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(dcdc, CONFIG_LOG_DEFAULT_LEVEL);
LOG_MODULE_REGISTER(dcdc, CONFIG_DCDC_LOG_LEVEL);
#endif
#include <math.h> // for fabs function
@@ -128,7 +128,7 @@ int Dcdc::perturb_observe_controller()
pwr_inc_goal = pwm_delta;
}
#if CONFIG_LOG_DEFAULT_LEVEL == LOG_LEVEL_DBG
#if CONFIG_DCDC_LOG_LEVEL == LOG_LEVEL_DBG
// workaround as LOG_DBG does not support float printing
printf("P: %.2fW (prev %.2fW), ind. current: %.2f, "
"in: %.2fV, %.2fA margin, out: %.2fV (target %.2fV), %.2fA margin, "