]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/debug.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
10 #define COMPAT_DEBUG_H
13 * A debug method for use of external helpers and tools.
14 * It shunts the debug messages down stderr for logging by Squid
15 * or display to the user instead of corrupting the stdout data stream.
23 SQUIDCEXTERN
int debug_enabled
;
25 /* the macro overload style is really a gcc-ism */
26 #if defined(__GNUC__) || defined(__SUNPRO_CC)
29 if (debug_enabled) { \
30 fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, static_cast<long>(getpid())); \
34 #define ndebug(content) ndebug_(__FILE__, __LINE__, content)
35 #define ndebug_(file, line, content) if (debug_enabled) { \
36 std::cerr << file << '(' << line << ')' << ": pid=" << getpid() << ':' \
37 << content << std::endl; \
40 #else /* __GNUC__ || __SUNPRO_CC */
42 /* non-GCC compilers can't do the above macro define yet. */
43 void debug(const char *format
,...);
46 #endif /* COMPAT_DEBUG_H */