#ifndef SQUID_DEBUG_H
#define SQUID_DEBUG_H
-/* NP: done without pre-requisite config.h */
-/* because we only define with it here. */
-#if HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
#include <iostream>
#undef assert
#include <sstream>
extern FILE *debug_log;
+SQUIDCEXTERN const char* SkipBuildPrefix(const char* path);
+
/* Debug stream */
#define debugs(SECTION, LEVEL, CONTENT) \
do { \
*
* debugs(1,2, HERE << "some message");
*/
-#define HERE basename(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "
+#define HERE SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "
/*
* MYNAME is for use at debug levels 0 and 1 where HERE is too messy.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
+
+/* Anyone moving the src/Debug.cc file MUST record its new location here,
+ * or there will be issues in the debugging statements, possibly fatal!
+ */
+#define RELATIVE_PATH_TO_DEBUG_CC "src/debug.cc"
+
#include "config.h"
#include "Debug.h"
#include "SquidTime.h"
}
std::ostringstream (*Debug::CurrentDebug)(NULL);
+
+static const size_t BuildPrefixInit()
+{
+ //leave immediately if misconfigured. Unfortunately not possible to detect at build
+ const char *file=__FILE__;
+ const char *rptdcc=RELATIVE_PATH_TO_DEBUG_CC;
+ assert(strstr(file,rptdcc)!=NULL);
+ return strlen(file)-strlen(rptdcc);
+}
+static const size_t BuildPrefixLength=BuildPrefixInit();
+const char* SkipBuildPrefix(const char* path)
+{
+ return path+BuildPrefixLength;
+}
+