add server to client remote logging

This commit is contained in:
Michael Davidsaver committed 2025-06-11 15:32:47 -07:00
1 parent 839fc01bfd
commit a372d936e8
10 files changed
+125 -17

No files matched your search

+17
View File
@@ -113,6 +113,23 @@ struct ServerIntrospectControl : public server::ConnectOp
virtual void onGet(std::function<void(std::unique_ptr<server::ExecOp>&& fn)>&& fn) override final {}
virtual void onPut(std::function<void(std::unique_ptr<server::ExecOp>&& fn, Value&&)>&& fn) override final {}
virtual void logRemote(Level lvl, const std::string& msg) override final
{
auto serv = server.lock();
if(!serv)
return;
std::string m(msg); // copy for bind
serv->acceptor_loop.dispatch([this, lvl, m](){
if(auto oper = op.lock()) {
if(auto chan = oper->chan.lock()) {
if(auto conn = chan->conn.lock()) {
conn->logRemote(oper->ioid, lvl, m);
}
}
}
});
}
const std::weak_ptr<server::Server::Pvt> server;
const std::weak_ptr<ServerIntrospect> op;