Expand description
Safe Rust wrapper for the Tencent Mars Xlog logging library.
This crate owns the high-level Rust API used by platform bindings and
direct Rust integrations. The default release surface is pure Rust and
built on top of mars-xlog-core; optional metrics hooks stay feature-gated
and out of the default public API.
§Quick start
use mars_xlog::{LogLevel, Xlog, XlogConfig};
let cfg = XlogConfig::new("/tmp/xlog", "demo");
let logger = Xlog::init(cfg, LogLevel::Info).expect("init xlog");
logger.log(LogLevel::Info, None, "hello from rust");
logger.flush(true);§Feature flags
macros:xlog!and level helpers that capture file/module/line.tracing:XlogLayerfortracing-subscriber.metrics: emits structured runtime metrics via themetricscrate.
Macros§
- xlog
- Log with explicit metadata captured by the macro call site.
- xlog_
debug - Convenience macro for
LogLevel::Debug. - xlog_
error - Convenience macro for
LogLevel::Error. - xlog_
info - Convenience macro for
LogLevel::Info. - xlog_
warn - Convenience macro for
LogLevel::Warn.
Structs§
- RawLog
Meta - Raw metadata carried by low-level wrappers (JNI/FFI parity path).
- Xlog
- Handle to a Mars Xlog instance.
- Xlog
Config - Configuration used to create an Xlog instance or open the global appender.
- Xlog
Layer tracing-subscriberlayer that forwards events to aXloginstance.- Xlog
Layer Config - Configuration for
XlogLayer. - Xlog
Layer Handle - Handle used to toggle a running
XlogLayer.
Enums§
- Appender
Mode - Controls whether logs are appended asynchronously or synchronously.
- Compress
Mode - Compression algorithm used for log buffers/files.
- File
IoAction - Result code returned by
Xlog::oneshot_flush. - LogLevel
- Log severity levels supported by Mars Xlog.
- Xlog
Error - Errors returned by Xlog initialization helpers.