@@ -8,6 +8,7 @@ use jsonwebtoken::jwk::JwkSet;
88use redact:: Secret ;
99use time:: Duration ;
1010use token_cache:: CliTokenDiskCache ;
11+ use tracing_log_error:: log_error;
1112
1213mod token;
1314mod token_cache;
@@ -58,7 +59,7 @@ pub fn background_token_refresh(
5859 . unwrap ( ) ;
5960 rt. block_on ( async {
6061 if let Err ( e) = _token_refresh ( & key_set, & locator, activation_key) . await {
61- tracing :: warn! ( error . msg = % e, error . details = ?e , "Failed to refresh the CLI token in the background" )
62+ log_error ! ( * e, level : tracing :: Level :: WARN , "Failed to refresh the CLI token in the background" ) ;
6263 }
6364 } ) ;
6465 } ) ;
@@ -106,7 +107,7 @@ async fn _check_activation_with_key(
106107 None
107108 }
108109 Err ( e) => {
109- tracing :: error! ( error . msg = % e, error . details = ?e , "Failed to retrieve a cached token from disk" , ) ;
110+ log_error ! ( * e, "Failed to retrieve a cached token from disk" ) ;
110111 None
111112 }
112113 } ;
@@ -115,11 +116,7 @@ async fn _check_activation_with_key(
115116 if let Some ( cached_jwt) = cached_jwt {
116117 match cached_jwt. validate ( key_set) {
117118 Err ( e) => {
118- tracing:: warn!(
119- error. msg = %e,
120- error. details = ?e,
121- "The cached CLI token is invalid. Obtaining a new one from Pavex's API." ,
122- ) ;
119+ log_error ! ( * e, level: tracing:: Level :: WARN , "The cached CLI token is invalid. Obtaining a new one from Pavex's API." ) ;
123120 }
124121 Ok ( proof) => {
125122 claims = Some ( proof) ;
@@ -138,11 +135,7 @@ async fn _check_activation_with_key(
138135 // We have a fresh token. Let's cache it to disk to avoid hitting the API
139136 // the next time Pavex CLI is invoked.
140137 if let Err ( e) = cache. upsert_token ( jwt. raw ( ) . clone ( ) ) . await {
141- tracing:: warn!(
142- error. msg = %e,
143- error. details = ?e,
144- "Failed to save the fresh CLI token to disk" ,
145- ) ;
138+ log_error ! ( * e, level: tracing:: Level :: WARN , "Failed to save the fresh CLI token to disk" ) ;
146139 }
147140
148141 claims
0 commit comments