Default debug stream formatting

From: Alex Rousskov <rousskov@dont-contact.us>
Date: Wed, 08 Aug 2007 08:28:34 -0600

Hi,

        Any objections to setting the default formatting flags for the Squid3
debugs() stream to "fixed" with a 2-digit precision? It would help to
convert cache.log messages like

        Took 6.6 seconds (3.5e+03 objects/sec).

into more readable/usable

        Took 7.12 seconds (3147.13 objects/sec).

without modifying the debugs() statements themselves (which is actually
impossible for flags like ios::fixed that do not have a stream
manipulator).

The patch is quoted below. Any other flags we should set by default?

If there are no objections, I will commit the patch.

Thank you,

Alex.

Index: src/debug.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/debug.cc,v
retrieving revision 1.14.4.2
diff -u -r1.14.4.2 debug.cc
--- src/debug.cc 2 May 2007 17:54:01 -0000 1.14.4.2
+++ src/debug.cc 8 Aug 2007 14:25:58 -0000
@@ -733,6 +733,9 @@
 Debug::getDebugOut() {
     assert (CurrentDebug == NULL);
     CurrentDebug = new std::ostringstream();
+ // set default formatting flags
+ CurrentDebug->setf(std::ios::fixed);
+ CurrentDebug->precision(2);
     return *CurrentDebug;
 }
 
Received on Wed Aug 08 2007 - 08:28:56 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Aug 31 2007 - 12:00:05 MDT