neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 44740e561fc93afe3ebecfd3618bda2d2abeafb0
parent 38a52caec09eb15c9ff8b4db6f0cdb7e2a28eb98
Author: Justin M. Keyes <justinkz@gmail.com>
Date:   Wed,  5 Feb 2025 13:23:33 -0800

fix(log): RPC log format #32337

Problem:
RPC log messages show `log_notify` function name, which is not useful:

    DBG 2025-02-04T22:28:02.419 ui.37862   log_notify:57: RPC -> 3: [notify]    nvim_ui_set_focus
    DBG 2025-02-04T22:28:02.419 nvim.37863.0 log_notify:57: RPC <- 1: [notify]    nvim_ui_set_focus

Solution:
Call logmsg() directly.

    DBG 2025-02-04T22:42:00.104 ui.40680   RPC: -> 3: [notify]    nvim_ui_attach
    DBG 2025-02-04T22:42:00.104 ui.40680   RPC: -> 3: [notify]    nvim_set_client_info
Diffstat:
Msrc/nvim/msgpack_rpc/channel.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c @@ -44,17 +44,20 @@ static void log_request(char *dir, uint64_t channel_id, uint32_t req_id, const char *name) { - DLOGN("RPC %s %" PRIu64 ": %s id=%u: %s\n", dir, channel_id, REQ, req_id, name); + logmsg(LOGLVL_DBG, "RPC: ", NULL, -1, false, "%s %" PRIu64 ": %s id=%u: %s\n", dir, channel_id, + REQ, req_id, name); } static void log_response(char *dir, uint64_t channel_id, char *kind, uint32_t req_id) { - DLOGN("RPC %s %" PRIu64 ": %s id=%u\n", dir, channel_id, kind, req_id); + logmsg(LOGLVL_DBG, "RPC: ", NULL, -1, false, "%s %" PRIu64 ": %s id=%u\n", dir, channel_id, kind, + req_id); } static void log_notify(char *dir, uint64_t channel_id, const char *name) { - DLOGN("RPC %s %" PRIu64 ": %s %s\n", dir, channel_id, NOT, name); + logmsg(LOGLVL_DBG, "RPC: ", NULL, -1, false, "%s %" PRIu64 ": %s %s\n", dir, channel_id, NOT, + name); } #else