From 439af1dca10fccb736ae363f2a290a82cc891a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 24 Nov 2025 21:11:19 +0100 Subject: [PATCH] feat(libstore): tie AWS CRT logging to Nix verbosity level Map Nix's verbosity levels to AWS CRT log levels so users can debug SSO authentication issues without modifying code: - Default/warn: AWS Warn (errors/warnings only) - Chatty (-vvv): AWS Info (credential provider actions) - Debug (-vvvv): AWS Debug (detailed auth flow) - Vomit (-vvvvv): AWS Trace (full CRT internal tracing) This makes it easy to diagnose SSO issues with: nix copy -vvvv --to s3://bucket?profile=foo ... --- src/libstore/aws-creds.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libstore/aws-creds.cc b/src/libstore/aws-creds.cc index ff7b0f0ef..dfdd81abb 100644 --- a/src/libstore/aws-creds.cc +++ b/src/libstore/aws-creds.cc @@ -79,7 +79,18 @@ class AwsCredentialProviderImpl : public AwsCredentialProvider public: AwsCredentialProviderImpl() { - apiHandle.InitializeLogging(Aws::Crt::LogLevel::Warn, static_cast(nullptr)); + // Map Nix's verbosity to AWS CRT log level + Aws::Crt::LogLevel logLevel; + if (verbosity >= lvlVomit) { + logLevel = Aws::Crt::LogLevel::Trace; + } else if (verbosity >= lvlDebug) { + logLevel = Aws::Crt::LogLevel::Debug; + } else if (verbosity >= lvlChatty) { + logLevel = Aws::Crt::LogLevel::Info; + } else { + logLevel = Aws::Crt::LogLevel::Warn; + } + apiHandle.InitializeLogging(logLevel, stderr); } AwsCredentials getCredentialsRaw(const std::string & profile);