comparison src/channel.c @ 14499:2661d77e440e v8.1.0263

patch 8.1.0263: channel log doesn't show part of channel commit https://github.com/vim/vim/commit/4b16ee743e26d65ecfb6231f7fd57869c3e5ff0d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 9 22:15:34 2018 +0200 patch 8.1.0263: channel log doesn't show part of channel Problem: Channel log doesn't show part of channel. Solution: Add "sock", "out", "err" or "in". (Ozaki Kiichi, closes https://github.com/vim/vim/issues/3303)
author Christian Brabandt <cb@256bit.org>
date Thu, 09 Aug 2018 22:30:06 +0200
parents f761a55a8aed
children 71c17b688bc6
comparison
equal deleted inserted replaced
14498:fdfdc1d231d9 14499:2661d77e440e
136 { 136 {
137 return log_fd != NULL; 137 return log_fd != NULL;
138 } 138 }
139 139
140 static void 140 static void
141 ch_log_lead(const char *what, channel_T *ch) 141 ch_log_lead(const char *what, channel_T *ch, ch_part_T part)
142 { 142 {
143 if (log_fd != NULL) 143 if (log_fd != NULL)
144 { 144 {
145 #ifdef FEAT_RELTIME 145 #ifdef FEAT_RELTIME
146 proftime_T log_now; 146 proftime_T log_now;
148 profile_start(&log_now); 148 profile_start(&log_now);
149 profile_sub(&log_now, &log_start); 149 profile_sub(&log_now, &log_start);
150 fprintf(log_fd, "%s ", profile_msg(&log_now)); 150 fprintf(log_fd, "%s ", profile_msg(&log_now));
151 #endif 151 #endif
152 if (ch != NULL) 152 if (ch != NULL)
153 fprintf(log_fd, "%son %d: ", what, ch->ch_id); 153 {
154 if (part < PART_COUNT)
155 fprintf(log_fd, "%son %d(%s): ",
156 what, ch->ch_id, part_names[part]);
157 else
158 fprintf(log_fd, "%son %d: ", what, ch->ch_id);
159 }
154 else 160 else
155 fprintf(log_fd, "%s: ", what); 161 fprintf(log_fd, "%s: ", what);
156 } 162 }
157 } 163 }
158 164
164 { 170 {
165 if (log_fd != NULL) 171 if (log_fd != NULL)
166 { 172 {
167 va_list ap; 173 va_list ap;
168 174
169 ch_log_lead("", ch); 175 ch_log_lead("", ch, PART_COUNT);
170 va_start(ap, fmt); 176 va_start(ap, fmt);
171 vfprintf(log_fd, fmt, ap); 177 vfprintf(log_fd, fmt, ap);
172 va_end(ap); 178 va_end(ap);
173 fputc('\n', log_fd); 179 fputc('\n', log_fd);
174 fflush(log_fd); 180 fflush(log_fd);
189 { 195 {
190 if (log_fd != NULL) 196 if (log_fd != NULL)
191 { 197 {
192 va_list ap; 198 va_list ap;
193 199
194 ch_log_lead("ERR ", ch); 200 ch_log_lead("ERR ", ch, PART_COUNT);
195 va_start(ap, fmt); 201 va_start(ap, fmt);
196 vfprintf(log_fd, fmt, ap); 202 vfprintf(log_fd, fmt, ap);
197 va_end(ap); 203 va_end(ap);
198 fputc('\n', log_fd); 204 fputc('\n', log_fd);
199 fflush(log_fd); 205 fflush(log_fd);
1847 head->rq_prev = node; 1853 head->rq_prev = node;
1848 } 1854 }
1849 1855
1850 if (ch_log_active() && lead != NULL) 1856 if (ch_log_active() && lead != NULL)
1851 { 1857 {
1852 ch_log_lead(lead, channel); 1858 ch_log_lead(lead, channel, part);
1853 fprintf(log_fd, "'"); 1859 fprintf(log_fd, "'");
1854 ignored = (int)fwrite(buf, len, 1, log_fd); 1860 ignored = (int)fwrite(buf, len, 1, log_fd);
1855 fprintf(log_fd, "'\n"); 1861 fprintf(log_fd, "'\n");
1856 } 1862 }
1857 return OK; 1863 return OK;
3716 return FAIL; 3722 return FAIL;
3717 } 3723 }
3718 3724
3719 if (ch_log_active()) 3725 if (ch_log_active())
3720 { 3726 {
3721 ch_log_lead("SEND ", channel); 3727 ch_log_lead("SEND ", channel, part);
3722 fprintf(log_fd, "'"); 3728 fprintf(log_fd, "'");
3723 ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd); 3729 ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd);
3724 fprintf(log_fd, "'\n"); 3730 fprintf(log_fd, "'\n");
3725 fflush(log_fd); 3731 fflush(log_fd);
3726 did_log_msg = TRUE; 3732 did_log_msg = TRUE;