diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index c74680daf7..054e4cac4e 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -42,6 +42,7 @@ jobs: -D CMAKE_C_COMPILER_LAUNCHER=sccache \ -D MAMBA_WARNING_AS_ERROR=ON \ -D BUILD_LIBMAMBAPY=OFF \ + -D BUILD_LIBMAMBA_SPDLOG_TESTS=ON \ -D ENABLE_MAMBA_ROOT_PREFIX_FALLBACK=OFF cmake --build build/ --parallel - name: Show build cache statistics @@ -87,6 +88,11 @@ jobs: run: | unset CONDARC # Interferes with tests ./build/libmamba/tests/test_libmamba_logging + - name: Run libmamba spdlog-based logging tests + shell: bash -elo pipefail {0} + run: | + unset CONDARC # Interferes with tests + ./build/libmamba-spdlog/tests/test_libmamba_logging_spdlog libmambapy_tests_unix: name: libmambapy tests diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index da9da428c7..e7dc917acd 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -43,6 +43,7 @@ jobs: -D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^ -D CMAKE_C_COMPILER_LAUNCHER=sccache ^ -D BUILD_LIBMAMBAPY=OFF ^ + -D BUILD_LIBMAMBA_SPDLOG_TESTS=ON ^ -D ENABLE_MAMBA_ROOT_PREFIX_FALLBACK=OFF if %errorlevel% neq 0 exit /b %errorlevel% cmake --build build/ --parallel @@ -89,6 +90,11 @@ jobs: run: | unset CONDARC # Interferes with tests cd ./build/libmamba && ./tests/test_libmamba_logging + - name: Run libmamba spdlog-based logging tests + shell: bash -elo pipefail {0} + run: | + unset CONDARC # Interferes with tests + cd ./build/libmamba && ../libmamba-spdlog/tests/test_libmamba_logging_spdlog - name: Run libmamba tests shell: bash -elo pipefail {0} run: | diff --git a/.gitignore b/.gitignore index 219da5a50c..af66c9fc93 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ CMakeLists.txt.user CMakeCache.txt CMakeFiles CMakeScripts -Testing + # There exist other Makefiles in /docs /Makefile cmake_install.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 21e1b0c7b3..fef3dfea00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ project(mamba) option(BUILD_SHARED "Build shared libmamba library" OFF) option(BUILD_STATIC "Build static libmamba library with static linkage to its dependencies" OFF) option(BUILD_LIBMAMBA "Build libmamba library" OFF) +option(BUILD_LIBMAMBA_SPDLOG_TESTS "Build libmamba-spdlog library tests" OFF) option(BUILD_LIBMAMBAPY "Build libmamba Python bindings" OFF) option(BUILD_LIBMAMBA_TESTS "Build libmamba C++ tests" OFF) option(BUILD_MAMBA "Build mamba" OFF) @@ -74,6 +75,9 @@ endif() # libmamba library and tests if(BUILD_LIBMAMBA) add_subdirectory(libmamba) + + # libmamba-spdlog library and tests (if enabled) + add_subdirectory(libmamba-spdlog) endif() # Python bindings of libmamba diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 8deff3603b..b1c3c396c3 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -154,6 +154,9 @@ function(mamba_target_add_compile_warnings target) set(warnings ${gcc_warnings}) endif() - target_compile_options("${target}" PRIVATE ${warnings}) + get_target_property(type ${target} TYPE) + if(NOT ${type} STREQUAL "INTERFACE_LIBRARY") + target_compile_options("${target}" PRIVATE ${warnings}) + endif() endfunction() diff --git a/dev/CMakePresetsMamba.json b/dev/CMakePresetsMamba.json index 8f70cb6fbd..51587aabbd 100644 --- a/dev/CMakePresetsMamba.json +++ b/dev/CMakePresetsMamba.json @@ -5,6 +5,7 @@ "BUILD_LIBMAMBA": "ON", "BUILD_LIBMAMBAPY": "ON", "BUILD_LIBMAMBA_TESTS": "ON", + "BUILD_LIBMAMBA_SPDLOG_TESTS": "ON", "BUILD_MAMBA_PACKAGE": "ON" }, "description": "Base profile for building libmamba and related", diff --git a/libmamba-spdlog/CMakeLists.txt b/libmamba-spdlog/CMakeLists.txt new file mode 100644 index 0000000000..e5c43d7800 --- /dev/null +++ b/libmamba-spdlog/CMakeLists.txt @@ -0,0 +1,96 @@ +# Copyright (c) 2025, QuantStack and Mamba Contributors +# +# Distributed under the terms of the BSD 3-Clause License. +# +# The full license is in the file LICENSE, distributed with this software. +cmake_minimum_required(VERSION 3.18.2) + +include("../cmake/CompilerWarnings.cmake") + +project(libmamba-spdlog) + +if(NOT TARGET mamba::libmamba) + find_package(libmamba CONFIG REQUIRED) + set(libmamba_target mamba::libmamba-dyn) +else() + set(libmamba_target mamba::libmamba) +endif() + +find_package(spdlog CONFIG REQUIRED) +find_package(Threads REQUIRED) + +# For some reasons, using target_compile_definitions does not set the definitions properly +add_compile_definitions(SPDLOG_FMT_EXTERNAL "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${BUILD_LOG_LEVEL}") + +add_library(libmamba-spdlog INTERFACE) +# target_sources(libmamba-spdlog INTERFACE include/mamba/spdlog/logging_spdlog.hpp +# include/mamba/spdlog/logging_spdlog_impl.hpp ) +add_library(mamba::libmamba-spdlog ALIAS libmamba-spdlog) + +target_include_directories( + libmamba-spdlog + INTERFACE $ $ +) + +target_link_libraries( + libmamba-spdlog + INTERFACE + ${libmamba_target} + # Since conda-forge spdlog is built with a bundled version of fmt we use the header only + # version to avoid chasing after the correct fmt version matching the one used in the + # bundle. + spdlog::spdlog_header_only + # We need the threading facilities available whatever the user use. This should have been + # part of depending on spdlog but for some reason it's not made available automatically. + Threads::Threads +) + +mamba_target_add_compile_warnings(libmamba-spdlog WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR}) + +target_compile_features(libmamba-spdlog INTERFACE cxx_std_20) +set_target_properties( + libmamba-spdlog + PROPERTIES + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO +) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Version.cmake" + VERSION 1.0 + COMPATIBILITY AnyNewerVersion +) +install( + TARGETS libmamba-spdlog + EXPORT ${PROJECT_NAME}Targets + LIBRARY DESTINATION lib COMPONENT Runtime + ARCHIVE DESTINATION lib COMPONENT Development + RUNTIME DESTINATION bin COMPONENT Runtime + PUBLIC_HEADER DESTINATION include COMPONENT Development + BUNDLE DESTINATION bin COMPONENT Runtime +) +configure_package_config_file( + "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) + +install( + EXPORT ${PROJECT_NAME}Targets + NAMESPACE mamba:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) + +install( + FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Version.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) + +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include) + +if(BUILD_LIBMAMBA_SPDLOG_TESTS) + add_subdirectory(tests/) +endif() diff --git a/libmamba-spdlog/cmake/libmamba-spdlogConfig.cmake.in b/libmamba-spdlog/cmake/libmamba-spdlogConfig.cmake.in new file mode 100644 index 0000000000..2c12f83f02 --- /dev/null +++ b/libmamba-spdlog/cmake/libmamba-spdlogConfig.cmake.in @@ -0,0 +1,5 @@ + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/libmamba/include/mamba/core/logging_spdlog.hpp b/libmamba-spdlog/include/mamba/spdlog/logging_spdlog.hpp similarity index 97% rename from libmamba/include/mamba/core/logging_spdlog.hpp rename to libmamba-spdlog/include/mamba/spdlog/logging_spdlog.hpp index a8873d753c..d52a6224e5 100644 --- a/libmamba/include/mamba/core/logging_spdlog.hpp +++ b/libmamba-spdlog/include/mamba/spdlog/logging_spdlog.hpp @@ -4,8 +4,8 @@ // // The full license is in the file LICENSE, distributed with this software. -#ifndef MAMBA_CORE_LOGGING_SPDLOG_HPP -#define MAMBA_CORE_LOGGING_SPDLOG_HPP +#ifndef MAMBA_LOGGING_SPDLOG_HPP +#define MAMBA_LOGGING_SPDLOG_HPP #include #include @@ -112,4 +112,6 @@ namespace mamba::logging::spdlogimpl } +#include "./logging_spdlog_impl.hpp" + #endif diff --git a/libmamba/src/core/logging_spdlog.cpp b/libmamba-spdlog/include/mamba/spdlog/logging_spdlog_impl.hpp similarity index 99% rename from libmamba/src/core/logging_spdlog.cpp rename to libmamba-spdlog/include/mamba/spdlog/logging_spdlog_impl.hpp index e89f8d21e2..87f1aa16d2 100644 --- a/libmamba/src/core/logging_spdlog.cpp +++ b/libmamba-spdlog/include/mamba/spdlog/logging_spdlog_impl.hpp @@ -3,6 +3,8 @@ // Distributed under the terms of the BSD 3-Clause License. // // The full license is in the file LICENSE, distributed with this software. +#pragma once + #include #include #include @@ -15,7 +17,6 @@ #include #include -#include #include #include diff --git a/libmamba-spdlog/tests/CMakeLists.txt b/libmamba-spdlog/tests/CMakeLists.txt new file mode 100644 index 0000000000..5d3296da45 --- /dev/null +++ b/libmamba-spdlog/tests/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.16) + +find_package(Catch2 REQUIRED) +find_package(Threads REQUIRED) + +add_executable(test_libmamba_logging_spdlog test_logging_spdlog.cpp) + +target_link_libraries( + test_libmamba_logging_spdlog + PUBLIC + mamba::libmamba + mamba::libmamba-spdlog + mamba::libtesting_mamba_logging_common + Catch2::Catch2WithMain + Threads::Threads +) + +target_compile_features(test_libmamba_logging_spdlog PUBLIC cxx_std_20) +set_target_properties( + test_libmamba_logging_spdlog + PROPERTIES + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO +) + +mamba_target_add_compile_warnings( + test_libmamba_logging_spdlog WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR} +) + +# ################################################################################################## + +add_custom_target( + test_logging_spdlog + COMMAND test_libmamba_logging_spdlog + DEPENDS test_libmamba_logging +) diff --git a/libmamba/tests/libmamba_logging/test_logging_spdlog.cpp b/libmamba-spdlog/tests/test_logging_spdlog.cpp similarity index 96% rename from libmamba/tests/libmamba_logging/test_logging_spdlog.cpp rename to libmamba-spdlog/tests/test_logging_spdlog.cpp index 8dd4408ce5..5a9871db25 100644 --- a/libmamba/tests/libmamba_logging/test_logging_spdlog.cpp +++ b/libmamba-spdlog/tests/test_logging_spdlog.cpp @@ -7,12 +7,12 @@ #include #include +#define CATCH_CONFIG_MAIN #include #include -#include - -#include "test_logging_common.hpp" +#include +#include namespace mamba::logging { diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 1ce117ffe1..4e3cf592b4 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -233,7 +233,6 @@ set( ${LIBMAMBA_SOURCE_DIR}/core/link.cpp ${LIBMAMBA_SOURCE_DIR}/core/link.hpp ${LIBMAMBA_SOURCE_DIR}/core/logging.cpp - ${LIBMAMBA_SOURCE_DIR}/core/logging_spdlog.cpp ${LIBMAMBA_SOURCE_DIR}/core/menuinst.cpp ${LIBMAMBA_SOURCE_DIR}/core/output.cpp ${LIBMAMBA_SOURCE_DIR}/core/package_cache.cpp @@ -382,7 +381,6 @@ set( ${LIBMAMBA_INCLUDE_DIR}/mamba/core/history.hpp ${LIBMAMBA_INCLUDE_DIR}/mamba/core/invoke.hpp ${LIBMAMBA_INCLUDE_DIR}/mamba/core/logging.hpp - ${LIBMAMBA_INCLUDE_DIR}/mamba/core/logging_spdlog.hpp ${LIBMAMBA_INCLUDE_DIR}/mamba/core/logging_tools.hpp ${LIBMAMBA_INCLUDE_DIR}/mamba/core/menuinst.hpp ${LIBMAMBA_INCLUDE_DIR}/mamba/core/output.hpp @@ -431,7 +429,6 @@ set( # ================ find_package(fmt CONFIG REQUIRED) -find_package(spdlog CONFIG REQUIRED) find_package(tl-expected CONFIG REQUIRED) find_package(nlohmann_json CONFIG REQUIRED) find_package(simdjson CONFIG REQUIRED) @@ -472,11 +469,6 @@ macro(libmamba_create_target target_name linkage output_name) mamba_target_add_compile_warnings(${target_name} WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR}) mamba_target_set_lto(${target_name} MODE ${MAMBA_LTO}) - # For some reasons, using target_compile_definitions does not set the definitions properly - add_compile_definitions( - SPDLOG_FMT_EXTERNAL "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${BUILD_LOG_LEVEL}" - ) - if(${linkage_upper} STREQUAL "STATIC") message(" -> Statically linking against libmamba (static) dependencies") @@ -486,7 +478,7 @@ macro(libmamba_create_target target_name linkage output_name) target_link_libraries( ${target_name} - PUBLIC fmt::fmt-header-only spdlog::spdlog_header_only yaml-cpp::yaml-cpp + PUBLIC fmt::fmt-header-only yaml-cpp::yaml-cpp PRIVATE reproc reproc++ @@ -629,15 +621,7 @@ macro(libmamba_create_target target_name linkage output_name) target_link_libraries( ${target_name} - PUBLIC - ${LIBSOLV_LIBRARIES} - ${LIBSOLVEXT_LIBRARIES} - yaml-cpp::yaml-cpp - fmt::fmt - # Since conda-forge spdlog is built with a bundled version of fmt we use the header - # only version to avoid chasing after the correct fmt version matching the one used - # in the bundle - spdlog::spdlog_header_only + PUBLIC ${LIBSOLV_LIBRARIES} ${LIBSOLVEXT_LIBRARIES} yaml-cpp::yaml-cpp fmt::fmt PRIVATE ${LibArchive_LIBRARIES} ${CURL_LIBRARIES} diff --git a/libmamba/include/mamba/core/context.hpp b/libmamba/include/mamba/core/context.hpp index d61e0ef86e..7e7a6b2edc 100644 --- a/libmamba/include/mamba/core/context.hpp +++ b/libmamba/include/mamba/core/context.hpp @@ -288,7 +288,9 @@ namespace mamba Ignored if `options.enable_logging == false`. If `options.enable_logging == true and log_handler.has_value() == false`, which is the default if this parameter is not specified, - then a default implementation-defined log handler implementation will be used. + then the log handler will not be changed; the current one, if it exists, stays. + If there is a current log-handler and your intent is to remove it, consider using + `mamba::logging::stop_logging()` instead. */ Context(const ContextOptions& options = {}, logging::AnyLogHandler log_handler = {}); diff --git a/libmamba/src/core/context.cpp b/libmamba/src/core/context.cpp index 1f41ece319..7e4c2995a7 100644 --- a/libmamba/src/core/context.cpp +++ b/libmamba/src/core/context.cpp @@ -12,7 +12,6 @@ #include "mamba/api/configuration.hpp" #include "mamba/core/context.hpp" #include "mamba/core/execution.hpp" -#include "mamba/core/logging_spdlog.hpp" #include "mamba/core/output.hpp" #include "mamba/core/thread_utils.hpp" #include "mamba/core/util.hpp" @@ -54,17 +53,10 @@ namespace mamba void Context::start_logging(logging::AnyLogHandler log_handler) { - if (not logging::get_log_handler()) // don't allow replacing one already set; THINK: OR DO - // WE ALLOW THAT???? + // Only change the log-handler if specified, keep the current one otherwise. + if (log_handler) { - if (log_handler) - { - logging::set_log_handler(std::move(log_handler), output_params); - } - else - { - logging::set_log_handler(logging::spdlogimpl::LogHandler_spdlog{}, output_params); - } + logging::set_log_handler(std::move(log_handler), output_params); } } diff --git a/libmamba/tests/CMakeLists.txt b/libmamba/tests/CMakeLists.txt index e802fa0c5d..76f90c359d 100644 --- a/libmamba/tests/CMakeLists.txt +++ b/libmamba/tests/CMakeLists.txt @@ -166,16 +166,30 @@ set_target_properties( # ################################################################################################## # libmamba logging system tests +add_library(libtesting_mamba_logging_common INTERFACE) +target_sources( + libtesting_mamba_logging_common + INTERFACE libmamba_logging/include/mamba/testing/test_logging_common.hpp +) +target_include_directories(libtesting_mamba_logging_common INTERFACE libmamba_logging/include/) + +add_library(mamba::libtesting_mamba_logging_common ALIAS libtesting_mamba_logging_common) + add_executable( test_libmamba_logging - libmamba_logging/test_logging_common.hpp libmamba_logging/test_main_logging.cpp libmamba_logging/test_logging_tools.cpp libmamba_logging/test_logging_anyloghandler.cpp - libmamba_logging/test_logging_spdlog.cpp ) -target_link_libraries(test_libmamba_logging PRIVATE mamba::libmamba Catch2::Catch2WithMain) +target_link_libraries( + test_libmamba_logging + PRIVATE + mamba::libmamba + Catch2::Catch2WithMain + Threads::Threads + mamba::libtesting_mamba_logging_common +) target_compile_features(test_libmamba_logging PUBLIC cxx_std_20) set_target_properties( diff --git a/libmamba/tests/libmamba_logging/test_logging_common.hpp b/libmamba/tests/libmamba_logging/include/mamba/testing/test_logging_common.hpp similarity index 100% rename from libmamba/tests/libmamba_logging/test_logging_common.hpp rename to libmamba/tests/libmamba_logging/include/mamba/testing/test_logging_common.hpp diff --git a/libmamba/tests/libmamba_logging/test_logging_anyloghandler.cpp b/libmamba/tests/libmamba_logging/test_logging_anyloghandler.cpp index f1d23fd5c8..10854b2643 100644 --- a/libmamba/tests/libmamba_logging/test_logging_anyloghandler.cpp +++ b/libmamba/tests/libmamba_logging/test_logging_anyloghandler.cpp @@ -11,10 +11,9 @@ #include #include +#include #include -#include "test_logging_common.hpp" - namespace mamba::logging { namespace testing diff --git a/libmamba/tests/libmamba_logging/test_logging_tools.cpp b/libmamba/tests/libmamba_logging/test_logging_tools.cpp index 1e79b420f0..7b07ddb6d9 100644 --- a/libmamba/tests/libmamba_logging/test_logging_tools.cpp +++ b/libmamba/tests/libmamba_logging/test_logging_tools.cpp @@ -11,13 +11,7 @@ #include #include - -#include "test_logging_common.hpp" - -// TODO: -// - specific tests for LogHandler_History -// - specific tests for LogHandler_StdOut - +#include namespace mamba::logging { diff --git a/libmamba/tests/libmamba_logging/test_main_logging.cpp b/libmamba/tests/libmamba_logging/test_main_logging.cpp index aab2bef157..10c50387dc 100644 --- a/libmamba/tests/libmamba_logging/test_main_logging.cpp +++ b/libmamba/tests/libmamba_logging/test_main_logging.cpp @@ -3,8 +3,7 @@ #include #include - -#include "test_logging_common.hpp" +#include namespace mamba::logging { diff --git a/libmambapy/CMakeLists.txt b/libmambapy/CMakeLists.txt index d4d8793484..decfbbc69c 100644 --- a/libmambapy/CMakeLists.txt +++ b/libmambapy/CMakeLists.txt @@ -16,6 +16,10 @@ else() set(libmamba_target mamba::libmamba) endif() +if(NOT TARGET mamba::libmamba-spdlog) + find_package(libmamba-spdlog CONFIG REQUIRED) +endif() + find_package(Python COMPONENTS Interpreter Development.Module) find_package(pybind11 REQUIRED) @@ -48,7 +52,7 @@ target_include_directories(bindings PRIVATE bindings) mamba_target_add_compile_warnings(bindings WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR}) -target_link_libraries(bindings PRIVATE pybind11::pybind11 ${libmamba_target}) +target_link_libraries(bindings PRIVATE pybind11::pybind11 ${libmamba_target} mamba::libmamba-spdlog) target_compile_features(bindings PUBLIC cxx_std_20) set_target_properties( bindings diff --git a/libmambapy/bindings/legacy.cpp b/libmambapy/bindings/legacy.cpp index a2860b2d54..886cbe115d 100644 --- a/libmambapy/bindings/legacy.cpp +++ b/libmambapy/bindings/legacy.cpp @@ -33,6 +33,7 @@ #include "mamba/core/util_os.hpp" #include "mamba/core/virtual_packages.hpp" #include "mamba/solver/problems_graph.hpp" +#include "mamba/spdlog/logging_spdlog.hpp" #include "mamba/validation/tools.hpp" #include "mamba/validation/update_framework_v0_6.hpp" @@ -74,7 +75,7 @@ namespace mambapy public: explicit Singletons(mamba::ContextOptions options) - : m_context(std::move(options)) + : m_context(std::move(options), mamba::logging::spdlogimpl::LogHandler_spdlog{}) { } diff --git a/micromamba/CMakeLists.txt b/micromamba/CMakeLists.txt index 7feffbd8ed..0f7942f4c3 100644 --- a/micromamba/CMakeLists.txt +++ b/micromamba/CMakeLists.txt @@ -83,7 +83,7 @@ macro(mambaexe_create_target target_name linkage output_name) if(NOT (TARGET mamba::libmamba-static)) find_package(libmamba REQUIRED) endif() - target_link_libraries(${target_name} PRIVATE mamba::libmamba-static) + target_link_libraries(${target_name} PRIVATE mamba::libmamba-static mamba::libmamba-spdlog) if(APPLE) target_link_options(${target_name} PRIVATE -nostdlib++) endif() @@ -93,7 +93,7 @@ macro(mambaexe_create_target target_name linkage output_name) if(NOT (TARGET mamba::libmamba-dyn)) find_package(libmamba REQUIRED) endif() - target_link_libraries(${target_name} PRIVATE mamba::libmamba-dyn) + target_link_libraries(${target_name} PRIVATE mamba::libmamba-dyn mamba::libmamba-spdlog) endif() list(APPEND mambaexe_targets ${target_name}) diff --git a/micromamba/src/main.cpp b/micromamba/src/main.cpp index 3d27f659c7..2104a86d08 100644 --- a/micromamba/src/main.cpp +++ b/micromamba/src/main.cpp @@ -23,6 +23,7 @@ #include "mamba/core/output.hpp" #include "mamba/core/thread_utils.hpp" #include "mamba/core/util_os.hpp" +#include "mamba/spdlog/logging_spdlog.hpp" #include "mamba/version.hpp" #include "umamba.hpp" @@ -35,9 +36,10 @@ main(int argc, char** argv) { mamba::MainExecutor scoped_threads; mamba::Context ctx{ { - .enable_logging = true, - .enable_signal_handling = true, - } }; + .enable_logging = true, + .enable_signal_handling = true, + }, + mamba::logging::spdlogimpl::LogHandler_spdlog{} }; mamba::Console console{ ctx }; mamba::Configuration config{ ctx };