# log-args-runtime
`log-args-runtime` is a lightweight runtime support crate for the [`log-args`](https://github.com/your-org/log-args) procedural macro. It provides thread-local storage and context management for structured logging spans and arguments.
## Purpose
This crate is not intended for direct use by end users. Instead, it is used internally by code generated by the `log-args` macro to propagate contextual information (such as parent spans) at runtime.
## Usage
You generally do not need to depend on `log-args-runtime` directly. It is used automatically when you use the `log-args` macro in your code. However, if you are developing custom integrations or want to interact with the runtime context, you can use the following API:
```rust
use log_args_runtime::__PARENT_LOG_ARGS;
// Example: setting and retrieving the parent log context
__PARENT_LOG_ARGS.with(|parent| {
*parent.borrow_mut() = Some("parent-context".to_string());
});
__PARENT_LOG_ARGS.with(|parent| {
if let Some(ctx) = &*parent.borrow() {
println!("Current parent context: {}", ctx);
}
});
```
## How it Works
- The crate exposes a thread-local variable `__PARENT_LOG_ARGS` which stores an optional string representing the parent log context.
- This is used by the macro-generated code to propagate span or context information across function boundaries.
## License
See the main repository for license information.