Is it possible to use the tracing crate within handlers? #1673
-
First off thanks for all the work that everyone put into 0.5, I'm playing around with it and it looks fantastic 😄 In 0.5 I understand that Rocket's logging infrastructure has been migrated to the #[macro_use] extern crate rocket;
#[macro_use] extern crate tracing;
#[get("/<name>/<age>")]
fn hello(name: &str, age: u8) -> String {
info!(
?name,
?age,
"Processing request",
);
format!("Hello, {} year old named {}!", age, name)
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/hello", routes![hello])
} I have an application built on actix that I'd like to port over to the new release which uses |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This unfortunately isn't the case yet. #21 and #1579 are the latest on moving over to |
Beta Was this translation helpful? Give feedback.
This unfortunately isn't the case yet. #21 and #1579 are the latest on moving over to
tracing
. For now, Rocket still useslog
. We don't document how to tap in in hopes of being able to migrate totracing
in a non-breaking release. But in a pinch, usinglog
macros will work and should continue to work even when we do migrate totracing
.