diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-13 11:26:37 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-13 11:26:37 +0200 |
commit | 8f990a4477aa126e6bc79b98ba5f6685b0658fe7 (patch) | |
tree | 9ea852d71f3afa201f5633eb789ff488c6df1358 /macros/src/caster.rs | |
parent | 89c238f9c82ade2d7656e2bee76838a391609a88 (diff) |
feat: add internal logging for macros
Diffstat (limited to 'macros/src/caster.rs')
-rw-r--r-- | macros/src/caster.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/macros/src/caster.rs b/macros/src/caster.rs index c36aa1f..417a881 100644 --- a/macros/src/caster.rs +++ b/macros/src/caster.rs @@ -18,16 +18,27 @@ use quote::{format_ident, quote, ToTokens}; use uuid::adapter::Simple; use uuid::Uuid; +#[cfg(syrette_macros_logging)] +use crate::util::tokens::ToTokensExt; + const CASTER_FN_NAME_PREFIX: &[u8] = b"__"; const FN_BUF_LEN: usize = CASTER_FN_NAME_PREFIX.len() + Simple::LENGTH; +#[cfg_attr(syrette_macros_logging, tracing::instrument(skip(ty, dst_trait)))] pub fn generate_caster( ty: &impl ToTokens, dst_trait: &impl ToTokens, sync: bool, ) -> TokenStream { + #[cfg(syrette_macros_logging)] + tracing::debug!( + source = %ty.to_str_pretty(), + destination = %ty.to_str_pretty(), + "Generating caster", + ); + let fn_ident = create_caster_fn_ident(Uuid::new_v4()); let new_caster = if sync { |