]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/test_tools.cc
3 * $Id: test_tools.cc,v 1.3 2003/07/08 23:01:47 robertc Exp $
5 * AUTHOR: Robert Collins
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 * Copyright (c) 2003 Robert Collins <robertc@squid-cache.org>
36 #define _SQUID_EXTERNNEW_
42 xassert(const char *msg
, const char *file
, int line
)
44 std::cout
<< "Assertion failed: (" << msg
<< ") at " << file
<< ":" << line
<< std::endl
;
47 time_t squid_curtime
= 0;
49 int Debug::Levels
[MAX_DEBUG_SECTIONS
];
53 _db_print_stderr(const char *format
, va_list args
);
57 _db_print(const char *format
,...)
63 const char *format
= NULL
;
66 LOCAL_ARRAY(char, f
, BUFSIZ
);
79 va_start(args1
, format
);
81 va_start(args2
, format
);
83 va_start(args3
, format
);
87 format
= va_arg(args1
, const char *);
91 snprintf(f
, BUFSIZ
, "%s| %s",
92 "stub time", //debugLogTime(squid_curtime),
95 _db_print_stderr(f
, args2
);
109 _db_print_stderr(const char *format
, va_list args
) {
111 // if (opt_debug_stderr < Debug::level)
112 if (1 < Debug::level
)
115 vfprintf(stderr
, format
, args
);
119 fatal(const char *message
) {
120 debug (0,0) ("Fatal: %s",message
);
127 assert (CurrentDebug
== NULL
);
128 CurrentDebug
= new std::ostringstream();
129 return *CurrentDebug
;
135 _db_print("%s\n", CurrentDebug
->str().c_str());
140 std::ostringstream
*Debug::CurrentDebug (NULL
);