@@ -568,7 +568,7 @@ template <typename Client>
568568void clientDestroy (Client& client)
569569{
570570 if (client.m_context .connection ) {
571- client.m_context .loop -> log ( ) << " IPC client destroy " << typeid (client).name ();
571+ MP_LOG (* client.m_context .loop , Log::Info ) << " IPC client destroy " << typeid (client).name ();
572572 } else {
573573 KJ_LOG (INFO, " IPC interrupted client destroy" , typeid (client).name ());
574574 }
@@ -577,7 +577,7 @@ void clientDestroy(Client& client)
577577template <typename Server>
578578void serverDestroy (Server& server)
579579{
580- server.m_context .loop -> log ( ) << " IPC server destroy " << typeid (server).name ();
580+ MP_LOG (* server.m_context .loop , Log::Info ) << " IPC server destroy " << typeid (server).name ();
581581}
582582
583583// ! Entry point called by generated client code that looks like:
@@ -605,7 +605,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
605605 // declaration so the server method runs in a dedicated thread.
606606 assert (!g_thread_context.loop_thread );
607607 g_thread_context.waiter = std::make_unique<Waiter>();
608- proxy_client.m_context .loop -> logPlain ( )
608+ MP_LOGPLAIN (* proxy_client.m_context .loop , Log::Info )
609609 << " {" << g_thread_context.thread_name
610610 << " } IPC client first request from current thread, constructing waiter" ;
611611 }
@@ -629,13 +629,13 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
629629 using FieldList = typename ProxyClientMethodTraits<typename Request::Params>::Fields;
630630 invoke_context.emplace (*proxy_client.m_context .connection , thread_context);
631631 IterateFields ().handleChain (*invoke_context, request, FieldList (), typename FieldObjs::BuildParams{&fields}...);
632- proxy_client.m_context .loop -> logPlain ( )
632+ MP_LOGPLAIN (* proxy_client.m_context .loop , Log::Info )
633633 << " {" << thread_context.thread_name << " } IPC client send "
634634 << TypeName<typename Request::Params>() << " " << LogEscape (request.toString (), proxy_client.m_context .loop ->m_log_opts .max_chars );
635635
636636 proxy_client.m_context .loop ->m_task_set ->add (request.send ().then (
637637 [&](::capnp::Response<typename Request::Results>&& response) {
638- proxy_client.m_context .loop -> logPlain ( )
638+ MP_LOGPLAIN (* proxy_client.m_context .loop , Log::Info )
639639 << " {" << thread_context.thread_name << " } IPC client recv "
640640 << TypeName<typename Request::Results>() << " " << LogEscape (response.toString (), proxy_client.m_context .loop ->m_log_opts .max_chars );
641641 try {
@@ -653,7 +653,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
653653 disconnected = " IPC client method call interrupted by disconnect." ;
654654 } else {
655655 kj_exception = kj::str (" kj::Exception: " , e).cStr ();
656- proxy_client.m_context .loop -> logPlain ( )
656+ MP_LOGPLAIN (* proxy_client.m_context .loop , Log::Info )
657657 << " {" << thread_context.thread_name << " } IPC client exception " << kj_exception;
658658 }
659659 const Lock lock (thread_context.waiter ->m_mutex );
@@ -665,8 +665,8 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
665665 Lock lock (thread_context.waiter ->m_mutex );
666666 thread_context.waiter ->wait (lock, [&done]() { return done; });
667667 if (exception) std::rethrow_exception (exception);
668- if (!kj_exception.empty ()) proxy_client.m_context .loop -> raise ( ) << kj_exception;
669- if (disconnected) proxy_client.m_context .loop -> raise ( ) << disconnected;
668+ if (!kj_exception.empty ()) MP_LOGPLAIN (* proxy_client.m_context .loop , Log::Raise ) << kj_exception;
669+ if (disconnected) MP_LOGPLAIN (* proxy_client.m_context .loop , Log::Raise ) << disconnected;
670670}
671671
672672// ! Invoke callable `fn()` that may return void. If it does return void, replace
@@ -700,7 +700,7 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
700700 using Results = typename decltype (call_context.getResults ())::Builds;
701701
702702 int req = ++server_reqs;
703- server.m_context .loop -> log ( ) << " IPC server recv request #" << req << " "
703+ MP_LOG (* server.m_context .loop , Log::Info ) << " IPC server recv request #" << req << " "
704704 << TypeName<typename Params::Reads>() << " " << LogEscape (params.toString (), server.m_context .loop ->m_log_opts .max_chars );
705705
706706 try {
@@ -717,14 +717,14 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
717717 return ReplaceVoid ([&]() { return fn.invoke (server_context, ArgList ()); },
718718 [&]() { return kj::Promise<CallContext>(kj::mv (call_context)); })
719719 .then ([&server, req](CallContext call_context) {
720- server.m_context .loop -> log ( ) << " IPC server send response #" << req << " " << TypeName<Results>()
720+ MP_LOG (* server.m_context .loop , Log::Info ) << " IPC server send response #" << req << " " << TypeName<Results>()
721721 << " " << LogEscape (call_context.getResults ().toString (), server.m_context .loop ->m_log_opts .max_chars );
722722 });
723723 } catch (const std::exception& e) {
724- server.m_context .loop -> log ( ) << " IPC server unhandled exception: " << e.what ();
724+ MP_LOG (* server.m_context .loop , Log::Info ) << " IPC server unhandled exception: " << e.what ();
725725 throw ;
726726 } catch (...) {
727- server.m_context .loop -> log ( ) << " IPC server unhandled exception" ;
727+ MP_LOG (* server.m_context .loop , Log::Info ) << " IPC server unhandled exception" ;
728728 throw ;
729729 }
730730}
0 commit comments