@@ -122,9 +122,10 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
122
122
int is_stdout ;
123
123
struct fpm_event_s * event ;
124
124
int fifo_in = 1 , fifo_out = 1 ;
125
- int is_last_message = 0 ;
126
125
int in_buf = 0 ;
127
126
int res ;
127
+ int init_stream_prefix_and_suffix = 1 ;
128
+ struct zlog_stream stream ;
128
129
129
130
if (!arg ) {
130
131
return ;
@@ -137,6 +138,8 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
137
138
event = & child -> ev_stderr ;
138
139
}
139
140
141
+ zlog_stream_init_for_stdio (& stream , ZLOG_WARNING , STDERR_FILENO );
142
+
140
143
while (fifo_in || fifo_out ) {
141
144
if (fifo_in ) {
142
145
res = read (fd , buf + in_buf , max_buf_size - 1 - in_buf );
@@ -151,7 +154,6 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
151
154
}
152
155
153
156
fpm_event_del (event );
154
- is_last_message = 1 ;
155
157
156
158
if (is_stdout ) {
157
159
close (child -> fd_stdout );
@@ -193,8 +195,13 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
193
195
* nl = '\0' ;
194
196
}
195
197
196
- zlog (ZLOG_WARNING , "[pool %s] child %d said into %s: \"%s\"%s" , child -> wp -> config -> name ,
197
- (int ) child -> pid , is_stdout ? "stdout" : "stderr" , buf , is_last_message ? ", pipe is closed" : "" );
198
+ if (init_stream_prefix_and_suffix ) {
199
+ zlog_stream_set_wrapping_prefix (& stream , "[pool %s] child %d said into %s: \"" ,
200
+ child -> wp -> config -> name , (int ) child -> pid , is_stdout ? "stdout" : "stderr" );
201
+ zlog_stream_set_wrapping_suffix (& stream , "\"" , ", pipe is closed" );
202
+ init_stream_prefix_and_suffix = 0 ;
203
+ }
204
+ zlog_stream_str (& stream , buf , strlen (buf ));
198
205
199
206
if (nl ) {
200
207
int out_buf = 1 + nl - buf ;
@@ -207,6 +214,8 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
207
214
}
208
215
}
209
216
}
217
+ zlog_stream_finish (& stream );
218
+ zlog_stream_destroy (& stream );
210
219
}
211
220
/* }}} */
212
221
0 commit comments