From: wessels <> Date: Tue, 20 Dec 2005 05:00:47 +0000 (+0000) Subject: Added "HERE" macro for use in debugs() and use it in a few ICAP X-Git-Tag: SQUID_3_0_PRE4~444 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=def17b6aae2697bc708272443b7ecddc34fc838b;p=thirdparty%2Fsquid.git Added "HERE" macro for use in debugs() and use it in a few ICAP debugging messages. --- diff --git a/src/Debug.h b/src/Debug.h index 6b9d90c6a8..9ef1448805 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -1,6 +1,6 @@ /* - * $Id: Debug.h,v 1.7 2003/08/31 21:20:08 robertc Exp $ + * $Id: Debug.h,v 1.8 2005/12/19 22:00:47 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -75,4 +75,11 @@ private: } \ } while (/*CONSTCOND*/ 0) +/* + * HERE is a macro that you can use like this: + * + * debugs(1,1, HERE << "some message"); + */ +#define HERE __FILE__<<"("<<__LINE__<<") " + #endif /* SQUID_DEBUG */ diff --git a/src/ICAP/ICAPModXact.cc b/src/ICAP/ICAPModXact.cc index da763b9a76..26650e5e38 100644 --- a/src/ICAP/ICAPModXact.cc +++ b/src/ICAP/ICAPModXact.cc @@ -694,7 +694,7 @@ void ICAPModXact::parseHttpHead() bool ICAPModXact::parseHead(HttpMsg *head) { assert(head); - debugs(93, 5, "have " << readBuf.contentSize() << " head bytes to parse" << + debugs(93, 5, HERE << "have " << readBuf.contentSize() << " head bytes to parse" << "; state: " << state.parsing); http_status error = HTTP_STATUS_NONE; diff --git a/src/ICAP/ICAPXaction.cc b/src/ICAP/ICAPXaction.cc index 2a6503ca9c..826aa25b03 100644 --- a/src/ICAP/ICAPXaction.cc +++ b/src/ICAP/ICAPXaction.cc @@ -88,7 +88,7 @@ void ICAPXaction::openConnection() connection = icapPconnPool->pop(s.host.buf(), s.port, NULL); if (connection >= 0) { - debug(93,3)("%s(%d) reused pconn FD %d\n", __FILE__, __LINE__, connection); + debugs(93,3, HERE << "reused pconn FD " << connection); eventAdd("ICAPXaction::reusedConnection", reusedConnection, this, @@ -147,10 +147,10 @@ void ICAPXaction::closeConnection() cancelRead(); if (reuseConnection) { - debug(93,3)("%s(%d) pushing pconn %d\n", __FILE__,__LINE__,connection); + debugs(93,3, HERE << "pushing pconn " << connection); icapPconnPool->push(connection, theService->host.buf(), theService->port, NULL); } else { - debug(93,3)("%s(%d) closing pconn %d\n", __FILE__,__LINE__,connection); + debugs(93,3, HERE << "closing pconn " << connection); comm_close(connection); } @@ -265,7 +265,7 @@ void ICAPXaction::noteCommRead(comm_err_t commStatus, size_t sz) Must(commStatus == COMM_OK); Must(sz >= 0); - debugs(93, 5, "read " << sz << " bytes"); + debugs(93, 5, HERE << "read " << sz << " bytes"); /* * See comments in ICAPXaction.h about why we use commBuf @@ -300,7 +300,7 @@ void ICAPXaction::cancelRead() bool ICAPXaction::parseHttpMsg(HttpMsg *msg) { - debugs(93, 5, "have " << readBuf.contentSize() << " head bytes to parse"); + debugs(93, 5, HERE << "have " << readBuf.contentSize() << " head bytes to parse"); http_status error = HTTP_STATUS_NONE; const bool parsed = msg->parse(&readBuf, commEof, &error);