Replies: 2 comments
-
@rlubos do you have any suggestions here? |
Beta Was this translation helpful? Give feedback.
-
OpenThread logging can be enabled with
I'm not sure if there's anything special about this particular function? I'd expect the log output to be forwarded to the default platform logger implementation:
After looking into the code I don't think dynamic log level support is actually implemented in Zephyr's OT port, at least I couldn't find an implementation of
Typically we create a corresponding Kconfig option for OT configuration options, and then translate them in a Zephyr-specific config file: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello All,
I search how to activate the good log level traces in Openthread zephyr. And in addition, i want to use otDumpDebgPlat() to prevent real time disturbance.
In modules/lib/openthread/src/core/api/logging_api.cpp, we retrieve otDumpDebgPlat() with
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_DEBG) && OPENTHREAD_CONFIG_LOG_PLATFORM && OPENTHREAD_CONFIG_LOG_PKT_DUMP
Logger::DumpInModule(kPlatformModuleName, kLogLevelDebg, aText, aData, aDataLength)
#else
In modules/lib/openthread/src/core/common/log.hpp, we have :
#define OT_SHOULD_LOG_AT(aLevel) (OT_SHOULD_LOG && (OPENTHREAD_CONFIG_LOG_LEVEL >= (aLevel)))
and #define OT_SHOULD_LOG (OPENTHREAD_CONFIG_LOG_OUTPUT != OPENTHREAD_CONFIG_LOG_OUTPUT_NONE)
So, we have to activate the log correctly with OPENTHREAD_CONFIG_LOG_OUTPUT .
I have added in a project prj.conf file, this :
CONFIG_LOG=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=y
But it is not enough. I have to have the following definitions :
#define OPENTHREAD_CONFIG_LOG_PLATFORM 1
#define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
But i don't know where to put these definitions.
I have set in modules/lib/openthread/include/openthread/platform/logging.h but it is not the good place, i think.
Ideally, a file like modules/lib/openthread/tests/toranj/openthread-core-toranj-config-posix.h which includes :
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
Thanks in advance for your support
Beta Was this translation helpful? Give feedback.
All reactions