]> granicus.if.org Git - vim/commitdiff
patch 9.0.0979: ch_log() text can be hard to find in the log file v9.0.0979
authorBram Moolenaar <Bram@vim.org>
Thu, 1 Dec 2022 11:02:23 +0000 (11:02 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 1 Dec 2022 11:02:23 +0000 (11:02 +0000)
Problem:    ch_log() text can be hard to find in the log file.
Solution:   Prepend "ch_log()" to the text.

runtime/doc/channel.txt
src/logfile.c
src/testdir/test_channel.vim
src/version.c

index fbe4d3fc2e68166907f24a6c25f67c2cb4c7b191..111a56d949cf9f84c988478bc26899e9aaea9792 100644 (file)
@@ -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
index 6c159b078f7116b09cb31ea0c624df3726c90c9f..673468ebad1ad3b0d87cbc8562c211c5a1b4804d 100644 (file)
@@ -177,7 +177,9 @@ f_ch_log(typval_T *argvars, typval_T *rettv UNUSED)
        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);
 }
 
 /*
index a99497d08e04a07d400b14bf1330e030b773e7dc..438db8e19692d6a86b31b5a6c98ae5d034e4b779 100644 (file)
@@ -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:')
index 537f6aa3557d3e8c04de03926ff8d3a25d72a008..a04419ae523c4bf151709483460011991cb61c14 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    979,
 /**/
     978,
 /**/