Log Management
1. Overview
The log management functionality of PSDK supports the output of four types of logs: Debug, Info, Warn, and Error, through output methods such as serial ports, terminals, or USB. The log structure output by the payload device developed with PSDK is as follows:
[Date Time][Log Level] [File Name: Line Number Function Name]: Log Content
2. Basic Concepts
- System Time: The time of the payload device when powered on is the system time of the payload device. After the payload device and the aircraft complete time synchronization, the payload device's time will be synchronized with the aircraft's time (in ms).
- Log Level: The log levels, from high to low, are Debug, Info, Warn, and Error. The log management module can print logs at or below the specified level.
- Log Content: The content of a single log should not be too long, ideally not exceeding 500 bytes.
Log Level | Log Content | Output Interface |
---|---|---|
debug | Debug information | fmt format interface:LOG_DEBUG print format interface:PLOG_DEBUG stream format interface:SLOG_DEBUG |
info | Key information | fmt format interface:LOG_INFO print format interface:PLOG_INFO stream format interface:SLOG_INFO |
warn | Warning information | fmt format interface:LOG_WARN print format interface:PLOG_WARN stream format interface:SLOG_WARN |
error | Error information | fmt format interface:LOG_ERROR print format interface:PLOG_ERROR stream format interface:SLOG_ERROR |
3. Log Viewing
By running the command line, you can view the output of logs in real time on the terminal.
4. Remote Logs
To facilitate problem diagnosis and analysis, PSDK supports remote logging functionality. Logs can be output to the aircraft through serial ports, terminals, or USB, and can be exported and viewed using aircraft tools. The remote logging interfaces provided by PSDK are as follows (Note: The remote log interface can only be used after the wait_register_ready()
function returns correctly):
///< Note: The following log interfaces use the print format.
RLOG_TRACE(format,...)
RLOG_DEBUG(format,...)
RLOG_INFO(format,...)
RLOG_WARN(format,...)
RLOG_ERROR(format,...)