[−][src]Crate tracing_stackdriver
tracing Subscriber for structuring Stackdriver-compatible
LogEntry
This crate provides a Layer
for use with a tracing Registry
that formats tracing Spans and Events into properly-structured JSON for consumption by Google Operations Logging
through the jsonPayload field.
This includes the following behaviors and enhancements:
rfc3339-formatted timestamps for all Eventsseverity(inLogSeverityformat) derived fromtracingLeveltargetderived from the EventtargetMetadata- Span
nameand custom fields included under aspankey - automatic nesting of
http_request.-prefixed event fields - automatic camelCase-ing of all field keys (e.g.
http_request->httpRequest)
use tracing_subscriber::{layer::SubscriberExt, Registry}; use tracing_stackdriver::Stackdriver; fn main() { let stackdriver = Stackdriver::default(); // writes to std::io::Stdout let subscriber = Registry::default().with(stackdriver); tracing::subscriber::set_global_default(subscriber).expect("Could not set up global logger"); }
Structs
| Stackdriver | A tracing adapater for stackdriver |