stas 2003/10/31 13:14:18
Modified: src/modules/perl modperl_io_apache.c Log: To improve the usability of the IO tracing dump only the first few dozens of characters in the string being written, read or flushed Revision Changes Path 1.7 +20 -5 modperl-2.0/src/modules/perl/modperl_io_apache.c Index: modperl_io_apache.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io_apache.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- modperl_io_apache.c 15 Oct 2003 00:42:34 -0000 1.6 +++ modperl_io_apache.c 31 Oct 2003 21:14:18 -0000 1.7 @@ -15,6 +15,16 @@ request_rec *r; } PerlIOApache; +/* not too long so it won't wrap when posted in email */ +#define IO_DUMP_LENGTH 35 +/* dumping hundreds of lines in the trace, makes it hard to read. Get + * a string chunk of IO_DUMP_LENGTH or less */ +#define IO_DUMP_FIRST_CHUNK(p, str, count) \ + count < IO_DUMP_LENGTH \ + ? (char *)str \ + : (char *)apr_psprintf(p, "%s...", \ + apr_pstrmemdup(p, str, IO_DUMP_LENGTH)) + /* _open just allocates the layer, _pushed does the real job of * filling the data in */ static PerlIO * @@ -114,7 +124,8 @@ total = ap_get_client_block(r, vbuf, count); MP_TRACE_o(MP_FUNC, "wanted %db, read %db [%s]", - count, total, (char *)vbuf); + count, total, + IO_DUMP_FIRST_CHUNK(r->pool, vbuf, total)); if (total < 0) { /* @@ -143,7 +154,8 @@ MP_CHECK_WBUCKET_INIT("print"); - MP_TRACE_o(MP_FUNC, "%d bytes [%s]", count, (char *)vbuf); + MP_TRACE_o(MP_FUNC, "%4db [%s]", count, + IO_DUMP_FIRST_CHUNK(rcfg->wbucket->pool, vbuf, count)); rv = modperl_wbucket_write(aTHX_ rcfg->wbucket, vbuf, &count); if (rv != APR_SUCCESS) { @@ -174,9 +186,12 @@ MP_CHECK_WBUCKET_INIT("flush"); - MP_TRACE_o(MP_FUNC, "%d bytes [%s]", rcfg->wbucket->outcnt, - apr_pstrmemdup(rcfg->wbucket->pool, rcfg->wbucket->outbuf, - rcfg->wbucket->outcnt)); + MP_TRACE_o(MP_FUNC, "%4db [%s]", rcfg->wbucket->outcnt, + IO_DUMP_FIRST_CHUNK(rcfg->wbucket->pool, + apr_pstrmemdup(rcfg->wbucket->pool, + rcfg->wbucket->outbuf, + rcfg->wbucket->outcnt), + rcfg->wbucket->outcnt)); MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE));