Use w/ 3rd party logging crate #1830
-
I'm working on a Rust project using Fastly's Compute@Edge platform. C@E allows you to choose a variety of logging backends; I'm using New Relic, which takes JSON input. The nice thing is that, if you use Fastly's log_fastly crate Fastly will handle your New Relic authentication for you, so all you do is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
If you want to actually use |
Beta Was this translation helpful? Give feedback.
log_fastly
appears to re-export thelog
crate's macros. If you want to usetracing
to export to thelog
crate, you can use the "log" feature flag on thetracing
crate to sendtracing
events to thelog
crate. However, this won't actually get you structured fields reported as JSON; they will just be formatted askey=value
in a string.If you want to actually use
tracing
to emit structured JSON logs, you would need to actually use atracing::Subscriber
implementation that consumestracing
's structured fields. Unfortunately, I don't think that will work nicely out of the box withlog_fastly
. If you want to continue using Fastly's logging infrastructure, rather than setting up your owntracing
…