Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

rixcpp/debug

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rix/debug

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.

Installation

vix add @rix/debug
vix install

Basic usage

#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/debug

Formatting

debug.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 brace

Format specifiers such as {:>10} or {:.2f} are intentionally not supported.

Logging

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: timeout

Printing

debug.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 3

For formatted strings, use debug.format or debug.log.

debug.print(debug.format("Hello {}", "Rix"));

Inspection

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.

Independent API

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;
}

Unified Rix facade

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;
}

Design

@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::Debug

This keeps the package usable on its own while allowing the unified Rix facade to mount it cleanly as:

rix.debug

Build

vix build

Run example

vix run

Tests

vix tests

License

MIT

About

Debug printing, formatting, logging, and inspection utilities for Rix.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.