Expand description
§Indigauge Core
Foundation crate for the Indigauge Rust SDK. It provides the shared building blocks that other crates build on:
- Event macros (
ig_info!,ig_warn!,ig_error!, etc.) with compile-time validation ofnamespace.eventnames. - Pluggable dispatcher so host environments (Bevy, servers, tools) decide how events are queued or sent.
- Optional tracing layer that forwards tracing spans/events to Indigauge.
- Optional panic handler that captures crashes as events (native targets).
- Hardware helpers (CPU/RAM bucketing, CPU name coarsening) for lightweight device context.
- Framework-agnostic runtime clients (
IndigaugeRuntimeClientasync +IndigaugeBlockingRuntimeClientnative blocking).
§Quick start
ⓘ
use indigauge_core::{ig_info, set_event_dispatcher};
use serde_json::Value;
fn dispatcher(_level: &'static str, etype: &str, meta: Option<Value>, _file: &'static str, _line: u32, _module: &'static str) -> bool {
println!("Dispatch {etype} with meta: {meta:?}");
true
}
fn main() {
set_event_dispatcher(dispatcher);
ig_info!("game.start", { "build": "dev" });
}§Features
panic_handler— capture panics as events (native targets only).tracing— exposeIndigaugeLayerandIndigaugeSinkto ship tracing events.
When panic_handler is enabled, the config-based panic hook also attempts to flush tracked pending events as a batch before sending the crash event and ending the session.
§Framework-agnostic runtime usage
Use indigauge-core directly when integrating with engines beyond Bevy (e.g. ggez, macroquad, Fyrox).
use indigauge_core::runtime::IndigaugeBlockingRuntimeClient;
use indigauge_core::types::{EventPayload, IndigaugeConfig};
let config = IndigaugeConfig::new("My Game", "PUBLIC_KEY", "1.0.0");
let sdk = IndigaugeBlockingRuntimeClient::new(config);
let event = EventPayload::new("game.start", "info", None, 0);
let request = sdk.event("SESSION_TOKEN", &event)?;
let _response = sdk.send(request)?;If you build your own engine adapter, call clear_pending_event_count after draining/sending queued events so crash-time flush only includes unsent events.
§License
Dual-licensed under MIT or Apache-2.0.
Modules§
Macros§
- enqueue_
ig_ event - Low-level helper used by the
ig_*macros to queue an event. - ig_
debug - Logs or enqueues a debug-level event to Indigauge.
- ig_
error - Logs or enqueues an error-level event to Indigauge.
- ig_
event - Emit an Indigauge event at the given level with optional structured metadata.
- ig_info
- Logs or enqueues an info-level event to Indigauge.
- ig_
trace - Logs or enqueues a trace-level event to Indigauge.
- ig_warn
- Logs or enqueues a warning-level event to Indigauge.