From 26f1c7b2dc51ba53c3b25f8a3fde4aa0855be826 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 18 Dec 2024 15:07:26 +0100 Subject: [PATCH] Silent logs I don't want to see what the ca-certs library does in my logs because it's generally too complex for me to understand and it generally just works. The errors generated by `fold_decode_pem_multiple` are especially problematic because I cannot do anything about them and the authenticator works as intended anyway. On NixOS, this message is repeated 175 times each time an authenticator is created: my_app: [WARNING] Ignoring undecodable trust anchor: ignore non certificate. --- lib/ca_certs.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ca_certs.ml b/lib/ca_certs.ml index 37feb5e..31c77a9 100644 --- a/lib/ca_certs.ml +++ b/lib/ca_certs.ml @@ -70,7 +70,7 @@ let windows_trust_anchors () = match X509.Certificate.decode_der cert with | Ok cert -> cert :: acc | Error (`Msg msg) -> - Log.warn (fun m -> m "Ignoring undecodable trust anchor: %s." msg); + Log.debug (fun m -> m "Ignoring undecodable trust anchor: %s." msg); Log.debug (fun m -> m "Full certificate:@.%a" (Ohex.pp_hexdump ()) cert); acc) @@ -86,10 +86,10 @@ let trust_anchors () = (Sys.getenv_opt "SSL_CERT_FILE", Sys.getenv_opt "NIX_SSL_CERT_FILE") with | Some x, _ -> - Log.info (fun m -> m "using %s (from SSL_CERT_FILE)" x); + Log.debug (fun m -> m "using %s (from SSL_CERT_FILE)" x); detect_one x | _, Some x -> - Log.info (fun m -> m "using %s (from NIX_SSL_CERT_FILE)" x); + Log.debug (fun m -> m "using %s (from NIX_SSL_CERT_FILE)" x); detect_one x | None, None -> ( let cmd = Bos.Cmd.(v "uname" % "-s") in @@ -112,7 +112,7 @@ let decode_pem_multiple data = (fun acc -> function | Ok t -> t :: acc | Error (`Msg msg) -> - Log.warn (fun m -> m "Ignoring undecodable trust anchor: %s." msg); + Log.debug (fun m -> m "Ignoring undecodable trust anchor: %s." msg); acc) [] data