Logging

micro routes all log output through SDL's logging backend. Messages include a priority level and are written to the platform's standard output.

Functions

namespace micro::log {
    log_stream debug();
    log_stream info();
    log_stream warn();
    log_stream error();
    log_stream critical();

    void set_priority(priority p);
}

Each function returns a temporary stream object. The message is flushed when the stream goes out of scope at the end of the statement.

micro::log::info()  << "Window created: " << win.title();
micro::log::warn()  << "Texture not found, using fallback";
micro::log::error() << "Failed to load: " << path;

Priority levels

Level Use for
debug Verbose diagnostics, disabled by default
info Normal operational messages
warn Recoverable issues
error Failures that affect correctness
critical Fatal conditions

Filtering

micro::log::set_priority(micro::log::priority::debug); // show all
micro::log::set_priority(micro::log::priority::warn);  // warnings and above only

The default priority is info. Call after init() (or inside entry).