2 * Copyright (C) 1996-2025 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 * A stub implementation of the Debug.h API.
11 * For use by test binaries which do not need the full context debugging
13 * Note: it doesn't use the STUB API as the functions defined here must
14 * not abort the unit test.
17 #include "debug/Stream.h"
19 #define STUB_API "debug/libdebug.la"
20 #include "tests/STUB.h"
22 char *Debug::debugOptions
;
23 char *Debug::cache_log
= nullptr;
24 int Debug::rotateNumber
= 0;
25 int Debug::Levels
[MAX_DEBUG_SECTIONS
];
26 int Debug::override_X
= 0;
27 bool Debug::log_syslog
= false;
28 void Debug::ForceAlert() STUB
30 void ResyncDebugLog(FILE *) STUB
43 Debug::FormatStream(std::ostream
&buf
)
45 const static std::ostringstream cleanStream
;
46 buf
.flags(cleanStream
.flags() | std::ios::fixed
);
47 buf
.width(cleanStream
.width());
53 Debug::LogMessage(const Context
&context
)
55 if (context
.level
> DBG_IMPORTANT
)
61 fprintf(stderr
, "%s| %s\n",
62 "stub time", // debugLogTime(current_time),
63 context
.buf
.str().c_str());
67 Debug::Extra(std::ostream
&os
)
74 bool Debug::StderrEnabled() STUB_RETVAL(false)
75 void Debug::PrepareToDie() STUB
78 Debug::parseOptions(char const *)
81 Debug::Context
*Debug::Current
= nullptr;
83 Debug::Context::Context(const int aSection
, const int aLevel
):
86 sectionLevel(Levels
[aSection
]),
94 Debug::Start(const int section
, const int level
)
96 Current
= new Context(section
, level
);
104 LogMessage(*Current
);
111 ForceAlert(std::ostream
& s
)