camel-component-log
Log component for rust-camel
Overview
The Log component logs exchange information using the tracing crate. It's useful for debugging, monitoring, and audit logging in integration flows.
This is a producer-only component - it can only be used as a destination (to) in routes, not as a source (from).
Features
- Multiple log levels (trace, debug, info, warn, error)
- Configurable body and header display
tracingintegration for structured logging- Pass-through processing (exchange continues unchanged)
Installation
Add to your Cargo.toml:
[]
= "0.2"
URI Format
log:category[?options]
URI Options
| Option | Default | Description |
|---|---|---|
level |
info |
Log level: trace, debug, info, warn, error |
showHeaders |
false |
Include headers in log output |
showBody |
true |
Include body in log output |
Usage
Basic Logging
use RouteBuilder;
use LogComponent;
let route = from
.to // Log at INFO level
.build?;
With Debug Level
let route = from
.to
.build?;
With Headers
let route = from
.to
.build?;
Body Only
let route = from
.to
.build?;
Log Output Format
[category] Body: <body> | Headers: {key1=value1, key2=value2}
When body is empty:
[category] Exchange received
Example: Request Logging
use RouteBuilder;
use LogComponent;
use CamelContext;
async
Documentation
License
Apache-2.0
Contributing
Contributions are welcome! Please see the main repository for details.