Skip to content

Diagnostics

Generated from engine/core/diagnostic.h at f525bc6. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.

Browse the core module

Audience: game code.

#include "engine/core/diagnostic.h" · namespace labrador

using DiagnosticCallback = void (*)(std::string_view message,
void* context) noexcept;

Receives one non-fatal engine message synchronously on its reporting thread. The message is borrowed until the call returns and may include a trailing newline. Copy it if it must be kept. The context is borrowed from the caller that installed the callback.

A callback must not throw, replace the callback, or recursively report diagnostics. Calls from different threads may overlap; the callback must synchronise its own shared state and must not call engine objects.

void set_diagnostic_callback(DiagnosticCallback callback,
void* context = nullptr) noexcept;

Replaces the one process-wide callback. nullptr restores stderr and ignores context. Set it before creating engine objects, or while no engine/diagnostic calls are in flight, including callbacks from drivers. Registration is not concurrent with reporting or another registration.

Keep the callback code and context alive until engine objects and their workers/driver callbacks have stopped, then reset before destroying the context. Browser frame callbacks outlive main, so their context must too. No callback state is owned, allocated or destroyed by this function.

void report_diagnostic(std::string_view message) noexcept;

Reports a non-fatal message through the current callback, or writes its exact bytes to stderr, adding a newline if one is absent. The engine retains no message or callback storage and performs no deferred call. There is no ordering guarantee between threads; stderr write failures are ignored. Fatal exceptions and browser Module.onError reporting are separate.

The files that include this header directly. A file can also reach it through another header.

Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.

All documentation versions