Plugin/Test Logging

DroneCore provides an API that developers can use for console logging in plugins and integration tests.

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 Dronecore apps (and we do not commit to maintaining compatibility in future versions).


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 showing progress and internal state.
Debug messages. These are 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 the vehicle isn't 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 DroneCore behaviour (e.g. communication link issues/retry failures). [04:55:08|Error] This is an error message (test_file.cpp:26)
© Dronecode 2017. License: CC BY 4.0            Updated: 2018-02-01 00:34:22

results matching ""

    No results matching ""