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 2197b67
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 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,13 +369,16 @@ 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.
#deprecated #vis struct #handler_fn_name { }


const GENERATED_MODULE: String = ::std::format!("{}::_rocket_route", ::std::module_path!());

/// Rocket code generated proxy static conversion implementations.
#[allow(nonstandard_style, deprecated, clippy::style)]
impl #handler_fn_name {
Expand Down

0 comments on commit 2197b67

Please sign in to comment.