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 <concepts>
#include <functional>
#include <memory>
#include <optional>
#include <source_location>
#include <sstream>
@ -83,10 +84,11 @@ namespace mamba
struct LogRecord
{
std::string message; // THINK: could be made lazy if it was a function instead
log_level level;
log_source source;
std::source_location location;
std::string message; // THINK: could be made lazy if it was a function instead, but
// requires macros to be functions
log_level level = log_level::off;
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
@ -154,7 +156,7 @@ namespace mamba
public:
constexpr AnyLogHandler() = default;
~AnyLogHandler() = default; // cannot be constexpr, unfortunately
~AnyLogHandler() = default; // cannot be constexpr, unfortunately
AnyLogHandler(AnyLogHandler&&) noexcept = default;
AnyLogHandler& operator=(AnyLogHandler&&) noexcept = default;

View File

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