]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/stub_debug.cc
2 * A stub implementation of the Debug.h API.
3 * For use by test binaries which do not need the full context debugging
12 FILE *debug_log
= NULL
;
13 int Debug::TheDepth
= 0;
15 char *Debug::debugOptions
;
16 char *Debug::cache_log
= NULL
;
17 int Debug::rotateNumber
= 0;
18 int Debug::Levels
[MAX_DEBUG_SECTIONS
];
20 int Debug::override_X
= 0;
21 int Debug::log_stderr
= 1;
22 bool Debug::log_syslog
= false;
25 ctx_enter(const char *descr
)
36 _db_init(const char *logfile
, const char *options
)
40 _db_set_syslog(const char *facility
)
48 _db_print_stderr(const char *format
, va_list args
);
51 _db_print(const char *format
,...)
53 static char f
[BUFSIZ
];
58 va_start(args1
, format
);
59 va_start(args2
, format
);
60 va_start(args3
, format
);
62 snprintf(f
, BUFSIZ
, "%s| %s",
63 "stub time", //debugLogTime(squid_curtime),
66 _db_print_stderr(f
, args2
);
74 _db_print_stderr(const char *format
, va_list args
)
77 // if (opt_debug_stderr < Debug::level)
82 vfprintf(stderr
, format
, args
);
88 assert(TheDepth
>= 0);
92 *CurrentDebug
<< std::endl
<< "reentrant debuging " << TheDepth
<< "-{";
94 assert(!CurrentDebug
);
95 CurrentDebug
= new std::ostringstream();
96 // set default formatting flags
97 CurrentDebug
->setf(std::ios::fixed
);
98 CurrentDebug
->precision(2);
100 return *CurrentDebug
;
104 Debug::parseOptions(char const *)
112 assert(TheDepth
>= 0);
113 assert(CurrentDebug
);
115 *CurrentDebug
<< "}-" << TheDepth
<< std::endl
;
117 assert(TheDepth
== 1);
118 _db_print("%s\n", CurrentDebug
->str().c_str());
126 Debug::xassert(const char *msg
, const char *file
, int line
)
130 *CurrentDebug
<< "assertion failed: " << file
<< ":" << line
<<
131 ": \"" << msg
<< "\"";
136 std::ostringstream
*Debug::CurrentDebug (NULL
);
139 SkipBuildPrefix(const char* path
)