Plugin/Test Logging

The Dronecode SDK provides an API that developers can use for console logging in plugins and integration tests. Basic message logging can be enabled by building with a specific #define.

Plugin Log API

The API methods display a custom message, prepending a timestamp and the type of log message (e.g. debug) and appending the origin of the message (file and line number).

The API should be considered "internal". It is not exported, or intended, for use in SDK apps (and we do not commit to maintaining compatibility in future versions).

Usage

The API is defined in core/log.h (and made available to integration tests via core/integration_test_helper.h).

The API methods are called as shown below for LogDebug(), with the left shift operator (<<) used to append the message-specific text.

#include "../path-to/core/log.h"
...
LogDebug() << "command unsupported (" << something.mavlink_command << ").";

Log Methods

Function Description Example
LogDebug() Debug messages.
For reporting internal progress/state.
Not displayed in RELEASE builds.
[04:55:08|Error] This is a debug message (test_file.cpp:26)
LogInfo() Information messages.
For reporting progress and status.
[04:55:08|Error] This is an information message (test_file.cpp:26)
LogWarn() Warning messages.
For reporting when vehicle not acting as commanded (e.g. rejecting commands).
[04:55:08|Error] This is a warning message (test_file.cpp:26)
LogErr() Error messages.
For reporting errors in SDK behaviour (e.g. communication link issues/retry failures).
[04:55:08|Error] This is an error message (test_file.cpp:26)

Message Logging

Basic logging is defined in source for both incoming (handled/ignored) and sent MAVLink messages.

This functionality is disabled by default, and available only in debug builds. To enable the logs, set #define MESSAGE_DEBUGGING 1 in core/system.cpp

© Dronecode 2017. License: CC BY 4.0            Updated: 2018-07-12 03:09:32

results matching ""

    No results matching ""