mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
cb4b28313b
This commit introduces the ability to set and manage log levels on a per-instance basis when dynamic logging is enabled, while maintaining backward compatibility with existing logging behaviors. The existing `otLoggingGetLevel()` and `otLoggingSetLevel()` APIs are repurposed to manage the "global" log level. They continue to behave exactly as before in both single-instance and multi-instance configurations, ensuring that existing users of these APIs do not need to change their implementations. To provide more granular control, new APIs `otGetLogLevel()` and `otSetLogLevel()` are added to handle per-instance log levels. Specifically, this commit makes the following changes: - Adds `mLogLevel` to `Instance` to track the instance-specific log level. - Renames the global log level static variable to `sGlobalLogLevel` and introduces `GetGlobalLogLevel()` and `SetGlobalLogLevel()` to manage it in a multi-instance configuration. - Updates `otGetLogLevel()` and `otSetLogLevel()` APIs to handle per-instance log level retrieval and configuration. If a specific level is not set for an instance, it falls back to the global log level. - Adds `mIsLogLevelSet` to distinguish between an explicitly set instance log level and the global fallback in multi-instance builds. - Introduces `otPlatLogHandleLogLevelChanged()` platform callback to notify the platform when an instance-specific log level is updated. - Updates Nexus tests to use `SetGlobalLogLevel()` instead of the deprecated instance `SetLogLevel()` method.