Skip to content

Use w/ 3rd party logging crate #1830

Answered by hawkw
kpeters-cbsi asked this question in Q&A
Discussion options

You must be logged in to vote

log_fastly appears to re-export the log crate's macros. If you want to use tracing to export to the log crate, you can use the "log" feature flag on the tracing crate to send tracing events to the log crate. However, this won't actually get you structured fields reported as JSON; they will just be formatted as key=value in a string.

If you want to actually use tracing to emit structured JSON logs, you would need to actually use a tracing::Subscriber implementation that consumes tracing's structured fields. Unfortunately, I don't think that will work nicely out of the box with log_fastly. If you want to continue using Fastly's logging infrastructure, rather than setting up your own tracing

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@acfoltzer
Comment options

@hawkw
Comment options

@kpeters-cbsi
Comment options

@kpeters-cbsi
Comment options

Answer selected by kpeters-cbsi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants