diff --git a/src/api.rs b/src/api.rs index 8bea20a..e10142d 100644 --- a/src/api.rs +++ b/src/api.rs @@ -90,7 +90,7 @@ impl WrappedResponse { &self, client: &impl Client, ) -> Result { - info!("Looking up wrapped response information"); + debug!("Looking up wrapped response information"); wrapping::lookup(client, self.info.token.as_str()) .await .map_err(|e| match &e { @@ -147,7 +147,7 @@ impl MiddleWare for EndpointMiddleware { req: &mut http::Request>, ) -> Result<(), rustify::errors::ClientError> { // Prepend API version to all requests - debug!( + trace!( "Middleware: prepending {} version to URL", self.version.as_str() ); @@ -157,7 +157,7 @@ impl MiddleWare for EndpointMiddleware { segs.insert(0, self.version.as_str()); url_c.set_path(format!("{}{}", self.version, url_c.path()).as_str()); *req.uri_mut() = http::Uri::from_str(url_c.as_str()).unwrap(); - debug!("Middleware: final URL is {}", url_c.as_str()); + trace!("Middleware: final URL is {}", url_c.as_str()); // Add X-Vault-Request to all requests req.headers_mut().append( @@ -167,7 +167,7 @@ impl MiddleWare for EndpointMiddleware { // Add Vault token to all requests if !self.token.is_empty() { - debug!("Middleware: adding token to header"); + trace!("Middleware: adding token to header"); req.headers_mut().append( "X-Vault-Token", http::HeaderValue::from_str(self.token.as_str()).unwrap(), @@ -176,7 +176,7 @@ impl MiddleWare for EndpointMiddleware { // Optionally wrap response if let Some(wrap) = &self.wrap { - info!("Middleware: adding wrap header with {} ttl", wrap); + trace!("Middleware: adding wrap header with {} ttl", wrap); req.headers_mut().append( "X-Vault-Wrap-TTL", http::HeaderValue::from_str(wrap.as_str()).unwrap(), @@ -185,7 +185,7 @@ impl MiddleWare for EndpointMiddleware { // Optionally wrap response if let Some(namespace) = &self.namespace { - info!("Middleware: adding namespace header {}", namespace); + trace!("Middleware: adding namespace header {}", namespace); req.headers_mut().append( "X-Vault-Namespace", http::HeaderValue::from_str(namespace.as_str()).unwrap(), @@ -213,7 +213,7 @@ pub async fn exec_with_empty(client: &impl Client, endpoint: E) -> Result<(), where E: Endpoint, { - info!("start request"); + trace!("start request"); endpoint .with_middleware(client.middle()) .exec(client.http()) @@ -231,7 +231,7 @@ pub async fn exec_with_empty_result(client: &impl Client, endpoint: E) -> Res where E: Endpoint, { - info!("start request"); + trace!("start request"); endpoint .with_middleware(client.middle()) .exec(client.http()) @@ -255,7 +255,7 @@ pub async fn exec_with_no_result( where E: Endpoint, { - info!("start request"); + trace!("start request"); endpoint .with_middleware(client.middle()) .exec(client.http()) @@ -289,7 +289,7 @@ pub async fn exec_with_result( where E: Endpoint, { - info!("start request"); + trace!("start request"); endpoint .with_middleware(client.middle()) .exec(client.http()) @@ -310,7 +310,7 @@ pub async fn wrap(client: &impl Client, endpoint: E) -> Result(client: &impl Client, endpoint: E) -> Result, { - info!( + trace!( "Executing {} and returning authentication info", endpoint.path() ); diff --git a/src/client.rs b/src/client.rs index 7ad88d1..173e20c 100644 --- a/src/client.rs +++ b/src/client.rs @@ -110,7 +110,7 @@ impl VaultClient { } })?; - info!("Importing CA certificate from {}", path); + debug!("Importing CA certificate from {}", path); http_client = http_client.add_root_certificate(cert); } @@ -202,10 +202,10 @@ impl VaultClientSettingsBuilder { fn default_address(&self) -> Result { let address = if let Ok(address) = env::var("VAULT_ADDR") { - info!("Using vault address from $VAULT_ADDR: {address}"); + debug!("Using vault address from $VAULT_ADDR: {address}"); address } else { - info!("Using default vault address http://127.0.0.1:8200"); + debug!("Using default vault address http://127.0.0.1:8200"); String::from("http://127.0.0.1:8200") }; let url = Url::parse(&address); @@ -219,18 +219,18 @@ impl VaultClientSettingsBuilder { fn default_token(&self) -> String { match env::var("VAULT_TOKEN") { Ok(s) => { - info!("Using vault token from $VAULT_TOKEN"); + debug!("Using vault token from $VAULT_TOKEN"); s } Err(_) => { - info!("Using default empty vault token"); + debug!("Using default empty vault token"); String::from("") } } } fn default_verify(&self) -> bool { - info!("Checking TLS verification using $VAULT_SKIP_VERIFY"); + debug!("Checking TLS verification using $VAULT_SKIP_VERIFY"); match env::var("VAULT_SKIP_VERIFY") { Ok(value) => !matches!(value.to_lowercase().as_str(), "0" | "f" | "false"), Err(_) => true, @@ -241,12 +241,12 @@ impl VaultClientSettingsBuilder { let mut paths: Vec = Vec::new(); if let Ok(s) = env::var("VAULT_CACERT") { - info!("Found CA certificate in $VAULT_CACERT"); + debug!("Found CA certificate in $VAULT_CACERT"); paths.push(s); } if let Ok(s) = env::var("VAULT_CAPATH") { - info!("Found CA certificate path in $VAULT_CAPATH"); + debug!("Found CA certificate path in $VAULT_CAPATH"); if let Ok(p) = fs::read_dir(s) { for path in p { paths.push(path.unwrap().path().to_str().unwrap().to_string())