log-args-runtime
Runtime support crate for the log_args
procedural macros, providing context storage and enriched logging macros.
Note: This is part of the log-args workspace. For complete setup and usage examples, see the main documentation.
Features
- Context Storage: Lightweight store that merges sync/async context across boundaries
- Enriched Logging: Drop-in macros (
info!
,warn!
,error!
,debug!
,trace!
) with automatic context - Cross-Boundary Propagation: Context inheritance across closures, async spawns, and WebSocket upgrades
- Structured Output: Optional
with_context
feature for JSON logging with flattened events
Installation
[]
= { = "0.1.4", = ["with_context"] }
= "0.1"
= { = "0.3", = ["json"] }
Note: The
with_context
feature includes a structuredcontext
field in log events. Disable it if you only want direct field logging.
Setup
For structured JSON logging with context fields at the top level:
Usage
use info;
Integration: When using
log_args
procedural macros, they automatically redefine logging macros within annotated functions to include function parameters and span context.
Architecture
This crate works in tandem with the log_args
procedural macro:
log_args
: Compile-time macro that rewrites functions to capture parameters and set up context propagationlog-args-runtime
: Runtime support providing context storage and enriched logging macros
Examples
See the workspace examples for complete demonstrations:
License
MIT - See LICENSE for details.