Logging - Platform

This module includes the platform abstraction for the debug log service.

Summary

Enumerations

otLogRegion{
  OT_LOG_REGION_API = 1,
  OT_LOG_REGION_MLE = 2,
  OT_LOG_REGION_ARP = 3,
  OT_LOG_REGION_NET_DATA = 4,
  OT_LOG_REGION_ICMP = 5,
  OT_LOG_REGION_IP6 = 6,
  OT_LOG_REGION_TCP = 7,
  OT_LOG_REGION_MAC = 8,
  OT_LOG_REGION_MEM = 9,
  OT_LOG_REGION_NCP = 10,
  OT_LOG_REGION_MESH_COP = 11,
  OT_LOG_REGION_NET_DIAG = 12,
  OT_LOG_REGION_PLATFORM = 13,
  OT_LOG_REGION_COAP = 14,
  OT_LOG_REGION_CLI = 15,
  OT_LOG_REGION_CORE = 16,
  OT_LOG_REGION_UTIL = 17,
  OT_LOG_REGION_BBR = 18,
  OT_LOG_REGION_MLR = 19,
  OT_LOG_REGION_DUA = 20,
  OT_LOG_REGION_BR = 21,
  OT_LOG_REGION_SRP = 22,
  OT_LOG_REGION_DNS = 23
}
enum
Represents log regions.

Typedefs

otLogLevel typedef
int
Represents the log level.
otLogRegion typedef
Represents log regions.

Functions

otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
void
Outputs logs.
otPlatLogHandleLevelChanged(otLogLevel aLogLevel)
void
Handles OpenThread log level changes.

Macros

OT_LOG_LEVEL_CRIT 1
Log level Critical.
OT_LOG_LEVEL_DEBG 5
Log level Debug.
OT_LOG_LEVEL_INFO 4
Log level Informational.
OT_LOG_LEVEL_NONE 0
Log level None.
OT_LOG_LEVEL_NOTE 3
Log level Notice.
OT_LOG_LEVEL_WARN 2
Log level Warning.

Enumerations

otLogRegion

 otLogRegion

Represents log regions.

The support for log region is removed and instead each core module can define its own name to appended to the logs. However, the otLogRegion enumeration is still defined as before to help with platforms which we may be using it in their otPlatLog() implementation. The OT core will always emit all logs with OT_LOG_REGION_CORE.

Properties
OT_LOG_REGION_API

OpenThread API.

OT_LOG_REGION_ARP

EID-to-RLOC mapping.

OT_LOG_REGION_BBR

Backbone Router (available since Thread 1.2)

OT_LOG_REGION_BR

Border Router.

OT_LOG_REGION_CLI

CLI.

OT_LOG_REGION_COAP

CoAP.

OT_LOG_REGION_CORE

OpenThread Core.

OT_LOG_REGION_DNS

DNS.

OT_LOG_REGION_DUA

Domain Unicast Address (available since Thread 1.2)

OT_LOG_REGION_ICMP

ICMPv6.

OT_LOG_REGION_IP6

IPv6.

OT_LOG_REGION_MAC

IEEE 802.15.4 MAC.

OT_LOG_REGION_MEM

Memory.

OT_LOG_REGION_MESH_COP

Mesh Commissioning Protocol.

OT_LOG_REGION_MLE

MLE.

OT_LOG_REGION_MLR

Multicast Listener Registration (available since Thread 1.2)

OT_LOG_REGION_NCP

NCP.

OT_LOG_REGION_NET_DATA

Network Data.

OT_LOG_REGION_NET_DIAG

Network Diagnostic.

OT_LOG_REGION_PLATFORM

Platform.

OT_LOG_REGION_SRP

Service Registration Protocol (SRP)

OT_LOG_REGION_TCP

TCP.

OT_LOG_REGION_UTIL

Utility module.

Typedefs

otLogLevel

int otLogLevel

Represents the log level.

otLogRegion

enum otLogRegion otLogRegion

Represents log regions.

The support for log region is removed and instead each core module can define its own name to appended to the logs. However, the otLogRegion enumeration is still defined as before to help with platforms which we may be using it in their otPlatLog() implementation. The OT core will always emit all logs with OT_LOG_REGION_CORE.

Functions

otPlatLog

void otPlatLog(
  otLogLevel aLogLevel,
  otLogRegion aLogRegion,
  const char *aFormat,
  ...
)

Outputs logs.

Note that the support for log region is removed. The OT core will always emit all logs with OT_LOG_REGION_CORE as aLogRegion.

Details
Parameters
[in] aLogLevel
The log level.
[in] aLogRegion
The log region.
[in] aFormat
A pointer to the format string.
[in] ...
Arguments for the format specification.

otPlatLogHandleLevelChanged

void otPlatLogHandleLevelChanged(
  otLogLevel aLogLevel
)

Handles OpenThread log level changes.

This platform function is called whenever the OpenThread log level changes. This platform function is optional since an empty weak implementation has been provided.

Details
Parameters
[in] aLogLevel
The new OpenThread log level.

Macros

OT_LOG_LEVEL_CRIT

 OT_LOG_LEVEL_CRIT 1

Log level Critical.

OT_LOG_LEVEL_DEBG

 OT_LOG_LEVEL_DEBG 5

Log level Debug.

OT_LOG_LEVEL_INFO

 OT_LOG_LEVEL_INFO 4

Log level Informational.

OT_LOG_LEVEL_NONE

 OT_LOG_LEVEL_NONE 0

Log level None.

OT_LOG_LEVEL_NOTE

 OT_LOG_LEVEL_NOTE 3

Log level Notice.

OT_LOG_LEVEL_WARN

 OT_LOG_LEVEL_WARN 2

Log level Warning.

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.