mirror of https://github.com/oxen-io/lokinet
hive fmt/spdlog updates
This commit is contained in:
parent
f6019210c3
commit
f9371233ee
|
@ -26,7 +26,7 @@ namespace tooling
|
||||||
|
|
||||||
auto routerId = llarp::RouterID(context->router->pubkey());
|
auto routerId = llarp::RouterID(context->router->pubkey());
|
||||||
container[routerId] = context;
|
container[routerId] = context;
|
||||||
std::cout << "Generated router with ID " << routerId << std::endl;
|
fmt::print("Generated router with ID {}\n", routerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -46,9 +46,9 @@ namespace tooling
|
||||||
{
|
{
|
||||||
auto& container = (isRelay ? relays : clients);
|
auto& container = (isRelay ? relays : clients);
|
||||||
|
|
||||||
for (auto [routerId, ctx] : container)
|
for (const auto& [routerId, ctx] : container)
|
||||||
{
|
{
|
||||||
routerMainThreads.emplace_back([=]() {
|
routerMainThreads.emplace_back([ctx = ctx, isRelay = isRelay]() {
|
||||||
ctx->Run(llarp::RuntimeOptions{false, false, isRelay});
|
ctx->Run(llarp::RuntimeOptions{false, false, isRelay});
|
||||||
});
|
});
|
||||||
std::this_thread::sleep_for(2ms);
|
std::this_thread::sleep_for(2ms);
|
||||||
|
|
|
@ -18,4 +18,3 @@ pybind11_add_module(pyllarp MODULE
|
||||||
)
|
)
|
||||||
target_link_libraries(pyllarp PUBLIC liblokinet)
|
target_link_libraries(pyllarp PUBLIC liblokinet)
|
||||||
target_include_directories(pyllarp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(pyllarp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_log_tag(pyllarp)
|
|
||||||
|
|
|
@ -17,11 +17,7 @@ namespace llarp
|
||||||
.def("ToPublic", &SecretKey::toPublic);
|
.def("ToPublic", &SecretKey::toPublic);
|
||||||
py::class_<Signature>(mod, "Signature")
|
py::class_<Signature>(mod, "Signature")
|
||||||
.def(py::init<>())
|
.def(py::init<>())
|
||||||
.def("__repr__", [](const Signature sig) -> std::string {
|
.def("__repr__", [](const Signature& sig) { return sig.ToHex(); });
|
||||||
std::stringstream ss;
|
|
||||||
ss << sig;
|
|
||||||
return ss.str();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace llarp
|
} // namespace llarp
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include <common.hpp>
|
#include <common.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <llarp/util/logging/logger.hpp>
|
#include <llarp/util/logging.hpp>
|
||||||
|
|
||||||
namespace llarp
|
namespace llarp
|
||||||
{
|
{
|
||||||
struct PyLogger
|
struct PyLogger
|
||||||
{
|
{
|
||||||
std::unique_ptr<LogSilencer> shutup;
|
std::optional<llarp::log::Level> silenced;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -16,15 +16,14 @@ namespace llarp
|
||||||
.def(py::init<>())
|
.def(py::init<>())
|
||||||
.def_property(
|
.def_property(
|
||||||
"shutup",
|
"shutup",
|
||||||
[](PyLogger& self) { return self.shutup != nullptr; },
|
[](PyLogger& self) { return self.silenced.has_value(); },
|
||||||
[](PyLogger& self, bool shutup) {
|
[](PyLogger& self, bool shutup) {
|
||||||
if (self.shutup == nullptr && shutup)
|
if (shutup and not self.silenced)
|
||||||
|
self.silenced = llarp::log::get_level_default();
|
||||||
|
else if (not shutup and self.silenced)
|
||||||
{
|
{
|
||||||
self.shutup = std::make_unique<LogSilencer>();
|
llarp::log::reset_level(*self.silenced);
|
||||||
}
|
self.silenced.reset();
|
||||||
else if (self.shutup != nullptr && shutup == false)
|
|
||||||
{
|
|
||||||
self.shutup.reset();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <llarp/router_contact.hpp>
|
#include <llarp/router_contact.hpp>
|
||||||
|
|
||||||
#include <llarp/dht/key.hpp>
|
#include <llarp/dht/key.hpp>
|
||||||
#include <common.hpp>
|
#include <llarp/util/time.hpp>
|
||||||
|
#include "common.hpp"
|
||||||
|
|
||||||
namespace llarp
|
namespace llarp
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include <llarp/util/logging/logger.hpp>
|
#include <llarp/util/logging.hpp>
|
||||||
|
|
||||||
PYBIND11_MODULE(pyllarp, m)
|
PYBIND11_MODULE(pyllarp, m)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,6 @@ PYBIND11_MODULE(pyllarp, m)
|
||||||
llarp::path::PathHopConfig_Init(m);
|
llarp::path::PathHopConfig_Init(m);
|
||||||
llarp::handlers::PyHandler_Init(m);
|
llarp::handlers::PyHandler_Init(m);
|
||||||
llarp::service::Address_Init(m);
|
llarp::service::Address_Init(m);
|
||||||
m.def("EnableDebug", []() { llarp::SetLogLevel(llarp::eLogDebug); });
|
m.def("EnableDebug", []() { llarp::log::reset_level(llarp::log::Level::debug); });
|
||||||
llarp::Logger_Init(m);
|
llarp::Logger_Init(m);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue