Debug utilities for Rix.
@rix/debug provides a small set of developer-focused tools for C++ projects:
- formatted strings
- simple logging
- value inspection
- print helpers
It can be used as an independent Rix package, or through the unified @rix/rix facade.
vix add @rix/debug
vix install#include <rix/debug.hpp>
int main()
{
rixlib::debug::Debug debug{};
debug.print("Hello", "Rix");
auto text = debug.format("Package: {}", "rix/debug");
debug.log("loaded {} rows", 3);
debug.log.warn("slow request: {}ms", 120);
debug.inspect(text);
return 0;
}Output:
Hello Rix
[debug] loaded 3 rows
[warn] slow request: 120ms
Package: rix/debugdebug.format supports simple placeholder-based formatting.
auto message = debug.format("Hello {}", "Rix");
auto result = debug.format("{0} + {0} = {1}", 2, 4);
auto escaped = debug.format("{{ value }} = {}", 42);Supported placeholders:
{} automatic argument indexing
{0} explicit positional indexing
{{ escaped opening brace
}} escaped closing braceFormat specifiers such as {:>10} or {:.2f} are intentionally not supported.
debug.log("loaded {} rows", 3);
debug.log.info("server started");
debug.log.warn("slow request: {}ms", 120);
debug.log.error("failed: {}", "timeout");Output:
[debug] loaded 3 rows
[info] server started
[warn] slow request: 120ms
[error] failed: timeoutdebug.print is not a formatter.
It prints values separated by spaces.
debug.print("Hello", "Rix");
debug.print(1, 2, 3);Output:
Hello Rix
1 2 3For formatted strings, use debug.format or debug.log.
debug.print(debug.format("Hello {}", "Rix"));debug.inspect(42);
auto value = debug.inspect.to_string(true);
bool ok = debug.inspect.check(42, 42);Inspection is useful for debugging values, containers, optional values, variants, and other supported C++ types.
You can also use the free functions directly.
#include <rix/debug.hpp>
int main()
{
rixlib::print("Hello", "Rix");
auto text = rixlib::format("Package: {}", "rix/debug");
rixlib::inspect(text);
return 0;
}When used through @rix/rix, the debug package is mounted under rix.debug.
#include <rix.hpp>
int main()
{
rix.debug.print("Hello", "Rix");
rix.debug.log("loaded {} rows", 3);
return 0;
}@rix/debug is intentionally small and focused.
It does not try to replace full logging frameworks or formatting libraries. Its role is to provide simple debugging primitives that are easy to use in Rix-based C++ projects.
The package exposes two layers:
rixlib::format(...)
rixlib::print(...)
rixlib::inspect(...)and the object-style API:
rixlib::debug::DebugThis keeps the package usable on its own while allowing the unified Rix facade to mount it cleanly as:
rix.debugvix buildvix runvix testsMIT