Logging - Thread Stack#
This module includes OpenThread logging related definitions.
Modules#
Functions#
Returns the current log level.
Sets the log level.
Emits a log message at critical log level.
Emits a log message at warning log level.
Emits a log message at note log level.
Emits a log message at info log level.
Emits a log message at debug log level.
Generates a memory dump at critical log level.
Generates a memory dump at warning log level.
Generates a memory dump at note log level.
Generates a memory dump at info log level.
Generates a memory dump at debug log level.
Emits a log message at given log level using a platform module name.
Emits a log message at given log level using a platform module name.
Emits a log message at a given log level.
Generates the next hex dump line.
Macros#
Hex dump line string size.
Function Documentation#
otLoggingGetLevel#
otLogLevel otLoggingGetLevel (void )
Returns the current log level.
N/A |
If dynamic log level feature OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
is enabled, this function returns the currently set dynamic log level. Otherwise, this function returns the build-time configured log level.
Returns
The log level.
64
of file include/openthread/logging.h
otLoggingSetLevel#
otError otLoggingSetLevel (otLogLevel aLogLevel)
Sets the log level.
[in] | aLogLevel | The log level. |
Note
This function requires
OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1
.
77
of file include/openthread/logging.h
otLogCritPlat#
void otLogCritPlat (const char * aFormat, ... )
Emits a log message at critical log level.
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
Is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below critical, this function does not emit any log message.
89
of file include/openthread/logging.h
otLogWarnPlat#
void void otLogWarnPlat (const char * aFormat, ... )
Emits a log message at warning log level.
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
Is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below warning, this function does not emit any log message.
101
of file include/openthread/logging.h
otLogNotePlat#
void void void otLogNotePlat (const char * aFormat, ... )
Emits a log message at note log level.
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
Is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below note, this function does not emit any log message.
113
of file include/openthread/logging.h
otLogInfoPlat#
void void void void otLogInfoPlat (const char * aFormat, ... )
Emits a log message at info log level.
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
Is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below info, this function does not emit any log message.
125
of file include/openthread/logging.h
otLogDebgPlat#
void void void void void otLogDebgPlat (const char * aFormat, ... )
Emits a log message at debug log level.
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
Is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below debug, this function does not emit any log message.
137
of file include/openthread/logging.h
otDumpCritPlat#
void void void void void void otDumpCritPlat (const char * aText, const void * aData, uint16_t aDataLength)
Generates a memory dump at critical log level.
[in] | aText | A string that is printed before the bytes. |
[in] | aData | A pointer to the data buffer. |
[in] | aDataLength | Number of bytes in |
If OPENTHREAD_CONFIG_LOG_PLATFORM
or OPENTHREAD_CONFIG_LOG_PKT_DUMP
is not set or the current log level is below critical this function does not emit any log message.
150
of file include/openthread/logging.h
otDumpWarnPlat#
void otDumpWarnPlat (const char * aText, const void * aData, uint16_t aDataLength)
Generates a memory dump at warning log level.
[in] | aText | A string that is printed before the bytes. |
[in] | aData | A pointer to the data buffer. |
[in] | aDataLength | Number of bytes in |
If OPENTHREAD_CONFIG_LOG_PLATFORM
or OPENTHREAD_CONFIG_LOG_PKT_DUMP
is not set or the current log level is below warning this function does not emit any log message.
163
of file include/openthread/logging.h
otDumpNotePlat#
void otDumpNotePlat (const char * aText, const void * aData, uint16_t aDataLength)
Generates a memory dump at note log level.
[in] | aText | A string that is printed before the bytes. |
[in] | aData | A pointer to the data buffer. |
[in] | aDataLength | Number of bytes in |
If OPENTHREAD_CONFIG_LOG_PLATFORM
or OPENTHREAD_CONFIG_LOG_PKT_DUMP
is not set or the current log level is below note this function does not emit any log message.
176
of file include/openthread/logging.h
otDumpInfoPlat#
void otDumpInfoPlat (const char * aText, const void * aData, uint16_t aDataLength)
Generates a memory dump at info log level.
[in] | aText | A string that is printed before the bytes. |
[in] | aData | A pointer to the data buffer. |
[in] | aDataLength | Number of bytes in |
If OPENTHREAD_CONFIG_LOG_PLATFORM
or OPENTHREAD_CONFIG_LOG_PKT_DUMP
is not set or the current log level is below info this function does not emit any log message.
189
of file include/openthread/logging.h
otDumpDebgPlat#
void otDumpDebgPlat (const char * aText, const void * aData, uint16_t aDataLength)
Generates a memory dump at debug log level.
[in] | aText | A string that is printed before the bytes. |
[in] | aData | A pointer to the data buffer. |
[in] | aDataLength | Number of bytes in |
If OPENTHREAD_CONFIG_LOG_PLATFORM
or OPENTHREAD_CONFIG_LOG_PKT_DUMP
is not set or the current log level is below debug this function does not emit any log message.
202
of file include/openthread/logging.h
otLogPlat#
void otLogPlat (otLogLevel aLogLevel, const char * aPlatModuleName, const char * aFormat, ... )
Emits a log message at given log level using a platform module name.
[in] | aLogLevel | The log level. |
[in] | aPlatModuleName | The platform sub-module name. |
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
This is is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below aLogLevel
, this function does not emit any log message.
The aPlatModuleName
name is used to determine the log module name in the emitted log message, following the P-{PlatModuleName}---
format. This means that the prefix string "P-" is added to indicate that this is a platform sub-module, followed by the next 12 characters of the PlatModuleName
string, with padded hyphens -
at the end to ensure that the region name is 14 characters long.
221
of file include/openthread/logging.h
otLogPlatArgs#
void void otLogPlatArgs (otLogLevel aLogLevel, const char * aPlatModuleName, const char * aFormat, va_list aArgs)
Emits a log message at given log level using a platform module name.
[in] | aLogLevel | The log level. |
[in] | aPlatModuleName | The platform sub-module name. |
[in] | aFormat | The format string. |
[in] | aArgs | Arguments for the format specification. |
This is is intended for use by platform. If OPENTHREAD_CONFIG_LOG_PLATFORM
is not set or the current log level is below aLogLevel
, this function does not emit any log message.
The aPlatModuleName
name is used to determine the log module name in the emitted log message, following the P-{PlatModuleName}---
format. This means that the prefix string "P-" is added to indicate that this is a platform sub-module, followed by the next 12 characters of the PlatModuleName
string, with padded hyphens -
at the end to ensure that the region name is 14 characters long.
241
of file include/openthread/logging.h
otLogCli#
void otLogCli (otLogLevel aLogLevel, const char * aFormat, ... )
Emits a log message at a given log level.
[in] | aLogLevel | The log level. |
[in] | aFormat | The format string. |
[in] | Arguments for the format specification. |
Is intended for use by CLI only. If OPENTHREAD_CONFIG_LOG_CLI
is not set or the current log level is below the given log level, this function does not emit any log message.
254
of file include/openthread/logging.h
otLogGenerateNextHexDumpLine#
otError otLogGenerateNextHexDumpLine (otLogHexDumpInfo * aInfo)
Generates the next hex dump line.
[inout] | aInfo | A pointer to |
Can call this method back-to-back to generate the hex dump output line by line. On the first call the mIterator
field in aInfo
MUST be set to zero.
Here is an example of the generated hex dump output:
"==========================[{mTitle} len=070]============================" "| 41 D8 87 34 12 FF FF 25 | 4C 57 DA F2 FB 2F 62 7F | A..4...%LW.../b. |" "| 3B 01 F0 4D 4C 4D 4C 54 | 4F 00 15 15 00 00 00 00 | ;..MLMLTO....... |" "| 00 00 00 01 80 DB 60 82 | 7E 33 72 3B CC B3 A1 84 | ......`.~3r;.... |" "| 3B E6 AD B2 0B 45 E7 45 | C5 B9 00 1A CB 2D 6D 1C | ;....E.E.....-m. |" "| 10 3E 3C F5 D3 70 | | .><..p |" "------------------------------------------------------------------------"
293
of file include/openthread/logging.h