diff --git a/src/log/configurator.cpp b/src/log/configurator.cpp index 1adcc618..644d4779 100644 --- a/src/log/configurator.cpp +++ b/src/log/configurator.cpp @@ -39,7 +39,6 @@ groups: - name: tls - name: listener_manager - name: libp2p_debug - level: trace # --------------- End of libp2p config ---------------)"); } diff --git a/test/testutil/prepare_loggers.hpp b/test/testutil/prepare_loggers.hpp index b70bb4eb..d655d4ef 100644 --- a/test/testutil/prepare_loggers.hpp +++ b/test/testutil/prepare_loggers.hpp @@ -18,8 +18,13 @@ namespace testutil { void prepareLoggers(soralog::Level level = soralog::Level::INFO) { std::call_once(initialized, [] { - - auto configurator = std::make_shared(std::string(R"( + // This is configuration part of logging system for using in tests. + // 1. It adds synchronous sink to console + // 2. Switches root group to them + // 3. Sets verbosity to info level + // 4. Add special group for tests + auto testing_log_config = std::string(R"( +# ---- Begin of logging system config addon ---- sinks: - name: console type: console @@ -29,18 +34,23 @@ sinks: groups: - name: libp2p sink: console - level: off - - name: libp2p_debug - level: trace -)")); + level: info + children: + - name: testing +# ----- End of logging system config addon ----- +)"); - auto logging_system = - std::make_shared(configurator); + auto logging_system = std::make_shared( + std::make_shared( + // Original LibP2P logging config + std::make_shared(), + // Additional logging config for testing + testing_log_config)); auto r = logging_system->configure(); if (r.has_error) { std::cerr << r.message << std::endl; - exit(EXIT_FAILURE); + throw std::runtime_error("Can't configure logger system"); } libp2p::log::setLoggingSystem(logging_system);