Logging - Thread Stack#

This module includes OpenThread logging related definitions.

Functions#

Returns the current log level.

otLoggingSetLevel(otLogLevel aLogLevel)

Sets the log level.

void
otLogCritPlat(const char *aFormat,...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(1

Emits a log message at critical log level.

void void
otLogWarnPlat(const char *aFormat,...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(1

Emits a log message at warning log level.

void void void
otLogNotePlat(const char *aFormat,...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(1

Emits a log message at note log level.

void void void void
otLogInfoPlat(const char *aFormat,...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(1

Emits a log message at info log level.

void void void void void
otLogDebgPlat(const char *aFormat,...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(1

Emits a log message at debug log level.

void void void void void void
otDumpCritPlat(const char *aText, const void *aData, uint16_t aDataLength)

Generates a memory dump at critical log level.

void
otDumpWarnPlat(const char *aText, const void *aData, uint16_t aDataLength)

Generates a memory dump at warning log level.

void
otDumpNotePlat(const char *aText, const void *aData, uint16_t aDataLength)

Generates a memory dump at note log level.

void
otDumpInfoPlat(const char *aText, const void *aData, uint16_t aDataLength)

Generates a memory dump at info log level.

void
otDumpDebgPlat(const char *aText, const void *aData, uint16_t aDataLength)

Generates a memory dump at debug log level.

void
otLogCli(otLogLevel aLogLevel, const char *aFormat,...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(2

Emits a log message at a given log level.

Function Documentation#

otLoggingGetLevel#

otLogLevel otLoggingGetLevel (void )

Returns the current log level.

Parameters
TypeDirectionArgument NameDescription
voidN/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.


otLoggingSetLevel#

otError otLoggingSetLevel (otLogLevel aLogLevel)

Sets the log level.

Parameters
TypeDirectionArgument NameDescription
otLogLevel[in]aLogLevel

The log level.

Note

  • This function requires OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1.


otLogCritPlat#

void otLogCritPlat (const char * aFormat, ... )

Emits a log message at critical log level.

Parameters
TypeDirectionArgument NameDescription
const char *[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.


otLogWarnPlat#

void void otLogWarnPlat (const char * aFormat, ... )

Emits a log message at warning log level.

Parameters
TypeDirectionArgument NameDescription
const char *[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.


otLogNotePlat#

void void void otLogNotePlat (const char * aFormat, ... )

Emits a log message at note log level.

Parameters
TypeDirectionArgument NameDescription
const char *[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.


otLogInfoPlat#

void void void void otLogInfoPlat (const char * aFormat, ... )

Emits a log message at info log level.

Parameters
TypeDirectionArgument NameDescription
const char *[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.


otLogDebgPlat#

void void void void void otLogDebgPlat (const char * aFormat, ... )

Emits a log message at debug log level.

Parameters
TypeDirectionArgument NameDescription
const char *[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.


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.

Parameters
TypeDirectionArgument NameDescription
const char *[in]aText

A string that is printed before the bytes.

const void *[in]aData

A pointer to the data buffer.

uint16_t[in]aDataLength

Number of bytes in aData.

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.


otDumpWarnPlat#

void otDumpWarnPlat (const char * aText, const void * aData, uint16_t aDataLength)

Generates a memory dump at warning log level.

Parameters
TypeDirectionArgument NameDescription
const char *[in]aText

A string that is printed before the bytes.

const void *[in]aData

A pointer to the data buffer.

uint16_t[in]aDataLength

Number of bytes in aData.

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.


otDumpNotePlat#

void otDumpNotePlat (const char * aText, const void * aData, uint16_t aDataLength)

Generates a memory dump at note log level.

Parameters
TypeDirectionArgument NameDescription
const char *[in]aText

A string that is printed before the bytes.

const void *[in]aData

A pointer to the data buffer.

uint16_t[in]aDataLength

Number of bytes in aData.

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.


otDumpInfoPlat#

void otDumpInfoPlat (const char * aText, const void * aData, uint16_t aDataLength)

Generates a memory dump at info log level.

Parameters
TypeDirectionArgument NameDescription
const char *[in]aText

A string that is printed before the bytes.

const void *[in]aData

A pointer to the data buffer.

uint16_t[in]aDataLength

Number of bytes in aData.

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.


otDumpDebgPlat#

void otDumpDebgPlat (const char * aText, const void * aData, uint16_t aDataLength)

Generates a memory dump at debug log level.

Parameters
TypeDirectionArgument NameDescription
const char *[in]aText

A string that is printed before the bytes.

const void *[in]aData

A pointer to the data buffer.

uint16_t[in]aDataLength

Number of bytes in aData.

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.


otLogCli#

void otLogCli (otLogLevel aLogLevel, const char * aFormat, ... )

Emits a log message at a given log level.

Parameters
TypeDirectionArgument NameDescription
otLogLevel[in]aLogLevel

The log level.

const char *[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.