Skip to content

Commit

Permalink
Identify logs we write in outside modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
hcldan committed Jun 6, 2024
1 parent 6a28edd commit 27d0c7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/codegen/src/attribute/route/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ fn request_guard_decl(guard: &Guard) -> TokenStream {
let #ident: #ty = match <#ty as #FromRequest>::from_request(#__req).await {
#Outcome::Success(__v) => __v,
#Outcome::Forward(__e) => {
::rocket::trace::info!(name: "forward", parameter = stringify!(#ident),
::rocket::trace::info!(name: "forward", target: &GENERATED_MODULE, parameter = stringify!(#ident),
type_name = stringify!(#ty), status = __e.code,
"request guard forwarding");

return #Outcome::Forward((#__data, __e));
},
#[allow(unreachable_code)]
#Outcome::Error((__c, __e)) => {
::rocket::trace::info!(name: "failure", parameter = stringify!(#ident),
::rocket::trace::info!(name: "failure", target: &GENERATED_MODULE, parameter = stringify!(#ident),
type_name = stringify!(#ty), reason = %#display_hack!(__e),
"request guard failed");

Expand Down Expand Up @@ -369,8 +369,9 @@ fn codegen_route(route: Route) -> Result<TokenStream> {
let format = Optional(route.attr.format.as_ref());

Ok(quote! {

#handler_fn

#[doc(hidden)]
#[allow(nonstandard_style)]
/// Rocket code generated proxy structure.
Expand All @@ -379,6 +380,7 @@ fn codegen_route(route: Route) -> Result<TokenStream> {
/// Rocket code generated proxy static conversion implementations.
#[allow(nonstandard_style, deprecated, clippy::style)]
impl #handler_fn_name {
const GENERATED_MODULE: String = ::std::format!("{}::_rocket_route", ::std::module_path!());
fn into_info(self) -> #_route::StaticInfo {
fn monomorphized_function<'__r>(
#__req: &'__r #Request<'_>,
Expand Down

0 comments on commit 27d0c7d

Please sign in to comment.