aws-iot-sdk: add variable to establish the logging level
Variable 'AWS_IOT_LOGGING_LEVEL' can be used from the project 'local.conf' to establish the logging level of the AWS IoT Device SDK. There are 6 incremental levels: none, error, warn, info, debug, and trace. Default is 'debug'. https://jira.digi.com/browse/DEL-4101 Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
parent
cd078339f7
commit
8a1a67f592
|
|
@ -63,3 +63,25 @@ AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL ?= "1000"
|
||||||
# to reconnect (milliseconds)
|
# to reconnect (milliseconds)
|
||||||
AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ?= "128000"
|
AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ?= "128000"
|
||||||
|
|
||||||
|
# Logging level control: error, warn, info, debug, trace.
|
||||||
|
AWS_IOT_LOGGING_LEVEL ?= "debug"
|
||||||
|
|
||||||
|
def get_log_level(d):
|
||||||
|
levels = ['error', 'warn', 'info', 'debug', 'trace']
|
||||||
|
log_flags = ""
|
||||||
|
|
||||||
|
log_level = d.getVar('AWS_IOT_LOGGING_LEVEL', True)
|
||||||
|
if log_level == 'none':
|
||||||
|
return ""
|
||||||
|
if log_level not in levels:
|
||||||
|
log_level = "debug"
|
||||||
|
d.setVar('AWS_IOT_LOGGING_LEVEL', log_level)
|
||||||
|
|
||||||
|
log_index = levels.index(log_level)
|
||||||
|
for i, val in enumerate(levels):
|
||||||
|
log_flags = log_flags + "-DENABLE_IOT_" + val.upper() + " "
|
||||||
|
if i == log_index:
|
||||||
|
break;
|
||||||
|
|
||||||
|
return log_flags
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ S = "${WORKDIR}/aws-iot-device-sdk-embedded-C-${PV}"
|
||||||
|
|
||||||
inherit awsiotsdk-c pkgconfig
|
inherit awsiotsdk-c pkgconfig
|
||||||
|
|
||||||
|
EXTRA_OEMAKE += "'LOG_FLAGS=${@get_log_level(d)}'"
|
||||||
|
|
||||||
do_configure() {
|
do_configure() {
|
||||||
cp -f ${WORKDIR}/awsiotsdk.pc ${S}
|
cp -f ${WORKDIR}/awsiotsdk.pc ${S}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue