Debug (std::debug)

Debugging utilities for structured logging and assertions. Some functions affect device logging configuration.

Usage

The std::debug library is available automatically. No import is required.

std::debug.record("starting");

Functions

std::debug.record(...any args): void

Description: Record a debug log entry with one or more values.

std::debug.record("tick", 123);

std::debug.start(string scriptName): void

Description: Mark the start of a debug session for the given script name.

std::debug.start("My Script");

std::debug.end(): void

Description: Mark the end of a debug session.

std::debug.end();

std::debug.assert(any expected, any actual, string errorMessage): void

Description: Assert that two values are equal; if not, report an error.

std::debug.assert(42, answer, "Answer mismatch");

std::debug.setSerialLogEnabled(bool newVal): bool

Description: Enable/disable serial logging; returns the previous value.

bool prev = std::debug.setSerialLogEnabled(true);

Related