1、Overview of Logging-Aastha Grover,Intel Corporation20232Agenda Overview Log APIs Architecture of Logging Subsystem Log Message and Memory Log Filtering Modes of Logging Multi Domain Logging Types of Logging formats:pros,cons Switch Formats at Runtime3 Logging outputs Human readable strings.printf li
2、ke results+more.String formatting cbprintf package Supports all format specifiers.Identify source of Logging Source module,severity level,time of generation(Timestamp)Timestamping Can log from any context Interrupt context Functionality to dump data LOG_HEXDUMP Log API for every Severity levels.Info
3、rmation,Debugging,Warning&Error Supports Multiple output channels.Example:UART Filesystem,Remote(Bluetooth,Net)Multiple backendsOverview4Source Code:Source Code:#include LOG_MODULE_REGISTER(MODULE,Level);LOG_INF(”String);KconfigKconfig:CONFIG_LOG=yHow to Log using Zephyr?Example:Example:Hello World
4、Application zephyr/samples/hello_worldTimestamp 5Logger APIsX=ERR,WRN,DBG,INFOX=ERR,WRN,DBG,INFOLOG_X :LOG_X :Standard printf-like messages.Eg:LOG_ERRLOG_INST_X LOG_INST_X:Associated with the particular instance.Eg:LOG_INST_INFOLOG_HEXDUMP_X:LOG_HEXDUMP_X:Dump hex data.LOG_INST_HEXDUMP_X:LOG_INST_HE
5、XDUMP_X:Dump hex data associated with a particular instance.LOG_PRINTK/LOG_RAW:LOG_PRINTK/LOG_RAW:Unconditionally print raw log message.LOG_MODULE_REGISTER:LOG_MODULE_REGISTER:Creates module-specific state and register the module with Logger.LOG_MODULE_DECLARE:LOG_MODULE_DECLARE:Declares a log modul
6、e(not register it).6FrontendFrontend Engaged by default when LOG API is called.Responsible for log filtering(Compile&Run-Time),buffer allocation,creating&committing the message.Optimized to log messages faster interrupt context.CoreCore Macros and functions needed for creating logging messages Enabl