Route all logging through the Void::Log facade
Delete the echoion Logger adapter (Logger.{hpp,cpp}) and the
ILogger/LoggerRegistry indirection. Core::installLogging() builds the
console + split-file Void::Logging::MultiLogger and installs it as the
process-wide Void::Log sink via Void::Log::make_sink (logSink_ owns it for
the process lifetime). The ~450 ECHOION_LOG_* call sites across EchoionCore
are rewritten to Void::Log::<level>("<Subsystem>", "{}", <expr>) with
per-file module tags (warning->warn, critical->fatal); the pre-formatted
message is passed as the single "{}" argument. Build green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e08ccaefa
commit
2d7651c308
42 files changed
+550
-792
No files matched your search
+18
-18
@@ -1,4 +1,4 @@
|
||||
#include "echoion/core/Logger.hpp"
|
||||
#include <Void/Log/Log.hpp>
|
||||
#include "echoion/core/RpcServer.hpp"
|
||||
#include <Void/Data/Json.hpp>
|
||||
#include <Void/Data/Reflect.hpp>
|
||||
@@ -33,7 +33,7 @@ namespace Echoion::Core
|
||||
CLIENT_POOL_SIZE);
|
||||
serverThread_ = std::thread(&RpcServer::acceptLoop, this);
|
||||
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("RpcServer", "{}",
|
||||
std::format("RPC server started on port {}", port));
|
||||
return {};
|
||||
} catch (const std::exception& e) {
|
||||
@@ -95,20 +95,20 @@ namespace Echoion::Core
|
||||
acceptor_->close(ec);
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO("RPC server stopped");
|
||||
Void::Log::info("RpcServer", "{}", "RPC server stopped");
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("Error stopping RPC server: {}", e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
void RpcServer::acceptLoop()
|
||||
{
|
||||
ECHOION_LOG_INFO("RPC server accept loop started");
|
||||
Void::Log::info("RpcServer", "{}", "RPC server accept loop started");
|
||||
while (running_.load()) {
|
||||
try {
|
||||
asio::ip::tcp::socket socket(ioContext_);
|
||||
ECHOION_LOG_DEBUG("RPC server waiting for connection...");
|
||||
Void::Log::debug("RpcServer", "{}", "RPC server waiting for connection...");
|
||||
|
||||
// Use async accept with cancellation support
|
||||
std::atomic<bool> acceptComplete{false};
|
||||
@@ -136,7 +136,7 @@ namespace Echoion::Core
|
||||
throw std::runtime_error(acceptEc.message());
|
||||
}
|
||||
|
||||
ECHOION_LOG_DEBUG(
|
||||
Void::Log::debug("RpcServer", "{}",
|
||||
std::format("RPC server accepted TCP connection from {}:{}",
|
||||
socket.remote_endpoint().address().to_string(),
|
||||
socket.remote_endpoint().port()));
|
||||
@@ -149,7 +149,7 @@ namespace Echoion::Core
|
||||
std::make_shared<websocket::stream<asio::ip::tcp::socket>>(
|
||||
std::move(socket));
|
||||
ws->accept();
|
||||
ECHOION_LOG_DEBUG("RPC server WebSocket handshake completed");
|
||||
Void::Log::debug("RpcServer", "{}", "RPC server WebSocket handshake completed");
|
||||
|
||||
uint64_t clientId = nextClientId_++;
|
||||
{
|
||||
@@ -157,7 +157,7 @@ namespace Echoion::Core
|
||||
clients_[clientId] = ws;
|
||||
}
|
||||
|
||||
ECHOION_LOG_DEBUG(
|
||||
Void::Log::debug("RpcServer", "{}",
|
||||
std::format("RPC client {} connected", clientId));
|
||||
|
||||
// Handle the client on the worker pool (drained/joined by
|
||||
@@ -175,7 +175,7 @@ namespace Echoion::Core
|
||||
std::lock_guard<std::mutex> lock(authMutex_);
|
||||
authenticatedClients_.erase(clientId);
|
||||
}
|
||||
ECHOION_LOG_DEBUG(std::format(
|
||||
Void::Log::debug("RpcServer", "{}", std::format(
|
||||
"RPC client {} disconnected", clientId));
|
||||
});
|
||||
}
|
||||
@@ -185,11 +185,11 @@ namespace Echoion::Core
|
||||
if (!running_.load()) {
|
||||
break;
|
||||
}
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("RPC accept error: {}", e.what()));
|
||||
}
|
||||
}
|
||||
ECHOION_LOG_INFO("RPC server accept loop stopped");
|
||||
Void::Log::info("RpcServer", "{}", "RPC server accept loop stopped");
|
||||
}
|
||||
|
||||
void RpcServer::handleClient(
|
||||
@@ -206,7 +206,7 @@ namespace Echoion::Core
|
||||
break;
|
||||
}
|
||||
if (ec) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("WebSocket read error: {}", ec.message()));
|
||||
break;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ namespace Echoion::Core
|
||||
}
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("Client handling error: {}", e.what()));
|
||||
break;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ namespace Echoion::Core
|
||||
sendResponse(clientId, response);
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("Message processing error: {}", e.what()));
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ namespace Echoion::Core
|
||||
Void::Json::serialize(Void::Json::to_json(response));
|
||||
it->second->write(asio::buffer(json));
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(std::format("Send response error: {}", e.what()));
|
||||
Void::Log::error("RpcServer", "{}", std::format("Send response error: {}", e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ namespace Echoion::Core
|
||||
Void::Json::serialize(Void::Json::to_json(notification));
|
||||
it->second->write(asio::buffer(json));
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("Send notification error: {}", e.what()));
|
||||
}
|
||||
}
|
||||
@@ -372,7 +372,7 @@ namespace Echoion::Core
|
||||
Void::Json::to_json(notification));
|
||||
ws->write(asio::buffer(json));
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("RpcServer", "{}",
|
||||
std::format("Broadcast error: {}", e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user