fixes from ci reports

This commit is contained in:
Klaim (Joël Lamotte) 2025-07-16 16:57:28 +02:00 committed by Joël Lamotte (Klaim)
parent 70388d6847
commit 6e65be5c9e
2 changed files with 28 additions and 23 deletions

View File

@ -11,6 +11,7 @@
#include <cassert> #include <cassert>
#include <concepts> #include <concepts>
#include <functional> #include <functional>
#include <memory>
#include <optional> #include <optional>
#include <source_location> #include <source_location>
#include <sstream> #include <sstream>
@ -83,10 +84,11 @@ namespace mamba
struct LogRecord struct LogRecord
{ {
std::string message; // THINK: could be made lazy if it was a function instead std::string message; // THINK: could be made lazy if it was a function instead, but
log_level level; // requires macros to be functions
log_source source; log_level level = log_level::off;
std::source_location location; log_source source = log_source::libmamba;
std::source_location location = {}; // assigned explicitly to please apple-clang
}; };
// NOTE: it might make more sense to talk about sinks than sources when it comes to the // NOTE: it might make more sense to talk about sinks than sources when it comes to the
@ -154,7 +156,7 @@ namespace mamba
public: public:
constexpr AnyLogHandler() = default; constexpr AnyLogHandler() = default;
~AnyLogHandler() = default; // cannot be constexpr, unfortunately ~AnyLogHandler() = default; // cannot be constexpr, unfortunately
AnyLogHandler(AnyLogHandler&&) noexcept = default; AnyLogHandler(AnyLogHandler&&) noexcept = default;
AnyLogHandler& operator=(AnyLogHandler&&) noexcept = default; AnyLogHandler& operator=(AnyLogHandler&&) noexcept = default;

View File

@ -290,19 +290,20 @@ namespace mamba::download
int int
curl_debug_callback(CURL* /* handle */, curl_infotype type, char* data, size_t size, void*) curl_debug_callback(CURL* /* handle */, curl_infotype type, char* data, size_t size, void*)
{ {
static constexpr auto symbol_for = [](curl_infotype type) { static constexpr auto symbol_for = [](curl_infotype type_)
switch (type) {
{ switch (type_)
case CURLINFO_TEXT: {
return "*"; case CURLINFO_TEXT:
case CURLINFO_HEADER_OUT: return "*";
return ">"; case CURLINFO_HEADER_OUT:
case CURLINFO_HEADER_IN: return ">";
return "<"; case CURLINFO_HEADER_IN:
default: return "<";
return ""; default:
}; return "";
}; };
};
switch (type) switch (type)
{ {
@ -310,12 +311,14 @@ namespace mamba::download
case CURLINFO_HEADER_OUT: case CURLINFO_HEADER_OUT:
case CURLINFO_HEADER_IN: case CURLINFO_HEADER_IN:
{ {
auto message = fmt::format("{} {}", symbol_for(type), Console::hide_secrets(std::string_view(data, size))); auto message = fmt::format(
logging::log({ "{} {}",
.message = std::move(message), symbol_for(type),
.level = log_level::info, Console::hide_secrets(std::string_view(data, size))
.source = log_source::libcurl );
}); logging::log({ .message = std::move(message),
.level = log_level::info,
.source = log_source::libcurl });
break; break;
} }
default: default: