Google is committed to advancing racial equity for Black communities. See how.

nl::Weave::Logging

This namespace includes all interfaces within Weave for shared logging support.

Summary

The interfaces include macros, constants, and functions for a platform-independent logging interface for the Weave SDK.

Weave SDK clients may choose, at compile time, among Android, C Standard I/O, or external (platform- and integrator-defined) logging style implementations that will be invoked when any of the following preprocessor symbols are asserted:

Enumerations

@406 enum
LogCategory enum
Identifies a category to which an particular error message belongs.
LogModule enum
Identifies a logical section of code that is a source of log messages.

Typedefs

LogMessageFunct)(uint8_t module, uint8_t category, const char *msg, va_list ap) typedef
void(*

Variables

ModuleNames[]
const char
gLogFilter = kLogCategory_Max
uint8_t
gLogFunct = DefaultLogMessage
LogMessageFunct

Functions

GetCategoryName(char *buf, uint8_t bufSize, uint8_t category)
void
GetLogFilter()
NL_DLL_EXPORT uint8_t
GetMessageWithPrefix(char *buf, uint8_t bufSize, uint8_t module, const char *msg)
void
GetModuleName(char *buf, uint8_t module)
void
Log(uint8_t module, uint8_t category, const char *msg, ...)
NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void
Log, to the platform-specified mechanism, the specified log message, msg, for the specified module, module, in the provided category, category.
PrintMessagePrefix(uint8_t module)
void
SetLogFilter(uint8_t category)
NL_DLL_EXPORT void
SetLogFunct(LogMessageFunct logFunct)
NL_DLL_EXPORT void

Enumerations

@406

 @406

LogCategory

 LogCategory

Identifies a category to which an particular error message belongs.

LogModule

 LogModule

Identifies a logical section of code that is a source of log messages.

Typedefs

LogMessageFunct

void(* LogMessageFunct)(uint8_t module, uint8_t category, const char *msg, va_list ap)

Variables

ModuleNames

const char ModuleNames[]

gLogFilter

uint8_t gLogFilter = kLogCategory_Max

gLogFunct

LogMessageFunct gLogFunct = DefaultLogMessage

Functions

GetCategoryName

void GetCategoryName(
  char *buf,
  uint8_t bufSize,
  uint8_t category
)

GetLogFilter

NL_DLL_EXPORT uint8_t GetLogFilter()

GetMessageWithPrefix

void GetMessageWithPrefix(
  char *buf,
  uint8_t bufSize,
  uint8_t module,
  const char *msg
)

GetModuleName

void GetModuleName(
  char *buf,
  uint8_t module
)

Log

NL_DLL_EXPORT __WEAVE_LOGGING_LINK_ATTRIBUTE void Log(
  uint8_t module,
  uint8_t category,
  const char *msg,
  ...
)

Log, to the platform-specified mechanism, the specified log message, msg, for the specified module, module, in the provided category, category.

Details
Parameters
[in] module
A LogModule enumeration indicating the source of the Weave package module that generated the log message. This must be translated within the function to a module name for inclusion in the log message.
[in] category
A LogCategory enumeration indicating the category of the log message. The category may be filtered in or out if WEAVE_LOG_FILTERING was asserted.
[in] msg
A pointer to a NULL-terminated C string with C Standard Library-style format specifiers containing the log message to be formatted and logged.
[in] ...
A variadic argument list whose elements should correspond to the format specifiers in msg.

PrintMessagePrefix

void PrintMessagePrefix(
  uint8_t module
)

SetLogFilter

NL_DLL_EXPORT void SetLogFilter(
  uint8_t category
)

SetLogFunct

NL_DLL_EXPORT void SetLogFunct(
  LogMessageFunct logFunct
)