Mercurial > vim
changeset 31291:16fc80710970 v9.0.0979
patch 9.0.0979: ch_log() text can be hard to find in the log file
Commit: https://github.com/vim/vim/commit/4f501171f7ba8fe3d24c7e5bf5fcec5b5f246df1
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 1 11:02:23 2022 +0000
patch 9.0.0979: ch_log() text can be hard to find in the log file
Problem: ch_log() text can be hard to find in the log file.
Solution: Prepend "ch_log()" to the text.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 01 Dec 2022 12:15:05 +0100 |
parents | 0a1b7fe2330a |
children | f319f6200220 |
files | runtime/doc/channel.txt src/logfile.c src/testdir/test_channel.vim src/version.c |
diffstat | 4 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -618,6 +618,9 @@ ch_info({handle}) *ch_info()* ch_log({msg} [, {handle}]) *ch_log()* Write String {msg} in the channel log file, if it was opened with |ch_logfile()|. + The text "ch_log():" is prepended to the message to make clear + it came from this function call and make it easier to find in + the log file. When {handle} is passed the channel number is used for the message. {handle} can be a Channel or a Job that has a Channel. The
--- a/src/logfile.c +++ b/src/logfile.c @@ -177,7 +177,9 @@ f_ch_log(typval_T *argvars, typval_T *re channel = get_channel_arg(&argvars[1], FALSE, FALSE, 0); #endif - ch_log(channel, "%s", msg); + // Prepend "ch_log()" to make it easier to find these entries in the + // logfile. + ch_log(channel, "ch_log(): %s", msg); } /*
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -2293,7 +2293,8 @@ func Test_zz_ch_log() call ch_log('%s%s') call ch_logfile('') let text = readfile('Xlog') - call assert_match("hello there", text[1]) + call assert_match("start log session", text[0]) + call assert_match("ch_log(): hello there", text[1]) call assert_match("%s%s", text[2]) call mkdir("Xchlogdir1", 'D') call assert_fails("call ch_logfile('Xchlogdir1')", 'E484:')