Skip to main content

Logging API

The Logging API is used to write diagnostic output from ArmorLink modules.

Log messages can be printed locally through Serial and, when requested by the ArmorLink App, forwarded as Remote Logs.

For the conceptual overview, see Remote Logging.

Basic Example

ArmorLink.debug("Button pressed");
ArmorLink.info("Pairing completed");
ArmorLink.warn("Battery voltage low");
ArmorLink.error("DFPlayer not responding");

Local Serial Logging

Serial logging is controlled through ArmorLinkOptions.

ArmorLinkOptions options;
options.enableSerialLogging = true;

When Serial logging is enabled, log messages are printed to the local Serial output.

Remote Logging

Remote Logging forwards log messages to the ArmorLink App.

Remote logs are only transmitted when requested by the ArmorLink App.

The remote logging state and active log level are controlled by the ArmorLink App.

tip

Remote Logging is on-demand.

ArmorLink avoids sending remote log traffic unless the ArmorLink App explicitly requests it.

Log Levels

ArmorLink provides four convenience methods.

MethodPurpose
debug(...)Detailed development information
info(...)General runtime information
warn(...)Unexpected situations
error(...)Failures and critical problems

debug(...)

ArmorLink.debug("Button pressed");

Use debug(...) for detailed development information.

info(...)

ArmorLink.info("Pairing completed");

Use info(...) for normal runtime events.

warn(...)

ArmorLink.warn("Battery voltage low");

Use warn(...) for unexpected situations that should be visible but do not necessarily stop operation.

error(...)

ArmorLink.error("DFPlayer not responding");

Use error(...) for failures or critical problems.

Logging from Actions

module.actions()
.add("toggleFaceplate")
.label("Toggle Faceplate")
.command("Facemask", "toggle")
.onExecute([]{
ArmorLink.info("Toggle Faceplate action executed");
toggleFaceplate();
});

For more information, see Actions API.

Logging from Application Logic

void btn1_handleClick()
{
ArmorLink.debug("BTN1 clicked");

ArmorLink.sendCommand(
"Helmet",
"Facemask",
"toggle"
);
}

Logging is useful when debugging local events such as buttons, sensors or timers.

forceRemoteLogging

Remote Logging is normally controlled by the ArmorLink App.

For development and troubleshooting it can be forced through ArmorLinkOptions.

ArmorLinkOptions options;
options.forceRemoteLogging = true;

For normal operation, this should usually remain disabled.

remoteLogMinIntervalMs

Defines the minimum interval between remote log messages.

ArmorLinkOptions options;
options.remoteLogMinIntervalMs = 100;

This helps prevent excessive remote log traffic.

info

Warning and error messages are considered important diagnostic events and are not rate-limited.

This helps ensure that important problems are still forwarded even when debug or info logs are throttled.

Logging vs Telemetry

Logging

Developer-focused diagnostic output:

  • Debug messages
  • Warnings
  • Errors
  • Execution traces

Telemetry

Structured runtime data:

  • Battery voltage
  • Temperature
  • Sensor values
  • System status

For more information, see Telemetry API.

Common Use Cases

Logging is useful for:

  • Debugging pairing
  • Checking command routing
  • Confirming Action execution
  • Inspecting button handlers
  • Diagnosing communication problems
  • Debugging installed modules without USB access

Summary

The Logging API provides diagnostic output for ArmorLink modules.

Common APIs include:

  • ArmorLink.debug(...)
  • ArmorLink.info(...)
  • ArmorLink.warn(...)
  • ArmorLink.error(...)

Common options include:

  • enableSerialLogging
  • forceRemoteLogging
  • remoteLogMinIntervalMs

Remote logs are only transmitted when requested by the ArmorLink App unless remote logging is explicitly forced.