20 #include <sigc++/sigc++.h> 65 explicit DebugStream(Debug::type t = Debug::NONE, Debug::verbosity v = 0);
69 DebugStream(
char const* f, Debug::type t = Debug::NONE,
bool truncate =
false );
74 typedef sigc::signal<void, const std::string&> StreamEvent_Signal;
75 StreamEvent_Signal signal_stream_event();
78 void level(Debug::type t) noexcept
80 dt = Debug::type(t & Debug::ANY);
84 Debug::type
level() const noexcept
92 dt = Debug::type(
dt | t);
98 dt = Debug::type(
dt & ~t);
102 virtual void logFile(
const std::string& f,
bool truncate =
false );
104 inline std::string getLogFile() const noexcept
110 inline void setLogFile(
const std::string& n ) noexcept
116 inline bool isOnLogFile() const noexcept
118 return isWriteLogFile;
122 inline void onLogFile(
bool truncate =
false )
128 inline void offLogFile() noexcept
134 void enableOnScreen();
137 void disableOnScreen();
140 inline bool debugging(Debug::type t = Debug::ANY)
const noexcept
149 std::ostream&
debug(Debug::type t = Debug::ANY) noexcept;
163 inline std::ostream&
to_end(Debug::type t) noexcept
171 std::ostream&
operator()(Debug::type t) noexcept;
173 inline void showDateTime(
bool s) noexcept
178 inline void showMilliseconds(
bool s ) noexcept
183 inline void showMicroseconds(
bool s ) noexcept
188 inline void showLogType(
bool s) noexcept
193 inline void showLabels(
bool s) noexcept
198 inline void hideLabelKey(
bool s) noexcept
203 inline std::ostream& log(Debug::type l) noexcept
208 void verbose(Debug::verbosity v) noexcept
223 typedef std::pair<std::string, std::string> Label;
225 void addLabel(
const std::string& key,
const std::string& value ) noexcept;
226 void delLabel(
const std::string& key ) noexcept;
227 void cleanupLabels() noexcept;
228 std::vector<Label> getLabels() noexcept;
236 #define DMANIP(FNAME,LEVEL) \ 237 inline std::ostream& FNAME( bool showdatetime=true ) noexcept \ 240 return operator[](Debug::LEVEL); \ 241 return operator()(Debug::LEVEL); \ 244 inline bool is_##FNAME() const noexcept\ 245 { return debugging(Debug::LEVEL); } 247 DMANIP(level1, LEVEL1)
248 DMANIP(level2, LEVEL2)
249 DMANIP(level3, LEVEL3)
250 DMANIP(level4, LEVEL4)
251 DMANIP(level5, LEVEL5)
252 DMANIP(level6, LEVEL6)
253 DMANIP(level7, LEVEL7)
254 DMANIP(level8, LEVEL8)
255 DMANIP(level9, LEVEL9)
259 DMANIP(repository, REPOSITORY)
260 DMANIP(system, SYSTEM)
261 DMANIP(exception, EXCEPTION)
265 std::ostream& printDate(Debug::type t,
char brk =
'/') noexcept;
266 std::ostream& printTime(
Debug::type t,
char brk = ':') noexcept;
267 std::ostream& printDateTime(
Debug::type t) noexcept;
269 std::ostream& pos(
int x,
int y) noexcept;
273 inline
void setLogName( const std::
string& n ) noexcept
278 inline std::string getLogName() const noexcept
284 void sbuf_overflow(
const std::string& s ) noexcept;
288 Debug::type
dt = { Debug::NONE };
295 bool show_datetime = {
true };
296 bool show_logtype = {
true };
297 bool show_msec = {
false };
298 bool show_usec = {
false };
299 std::string fname = {
"" };
301 StreamEvent_Signal s_stream;
302 std::string logname = {
"" };
304 bool isWriteLogFile = {
false };
305 bool onScreen = {
true };
307 Debug::verbosity verb = { 0 };
308 Debug::verbosity vv = { 0 };
310 std::vector<Label> labels;
311 bool show_labels = {
true };
312 bool hide_label_key = {
false };
Definition: DebugStream.h:61
Debug::type dt
The current debug level.
Definition: DebugStream.h:288
bool debugging(Debug::type t=Debug::ANY) const noexcept
Returns true if t is part of the current debug level.
Definition: DebugStream.h:140
std::ostream & operator[](Debug::type t) noexcept
Definition: DebugStream.h:155
std::ostream nullstream
The no-op stream.
Definition: DebugStream.h:290
Debug::verbosity verbose() const noexcept
Returns the current verbose level.
Definition: DebugStream.h:214
void addLevel(Debug::type t) noexcept
Adds t to the current debug level.
Definition: DebugStream.h:90
void delLevel(Debug::type t) noexcept
Deletes t from the current debug level.
Definition: DebugStream.h:96
std::ostream & to_end(Debug::type t) noexcept
Definition: DebugStream.h:163
virtual void logFile(const std::string &f, bool truncate=false)
Sets the debugstreams' logfile to f.
Definition: DebugStream.cc:104
DebugStream(Debug::type t=Debug::NONE, Debug::verbosity v=0)
Constructor, sets the debug level to t.
Definition: DebugStream.cc:34
std::ostream & debug(Debug::type t=Debug::ANY) noexcept
Definition: DebugStream.cc:161
std::ostream & operator()(Debug::type t) noexcept
Definition: DebugStream.cc:192
void level(Debug::type t) noexcept
Sets the debug level to t.
Definition: DebugStream.h:78
So that public parts of DebugStream does not need to know about filebuf.
Definition: DebugExtBuf.h:357
Debug::type level() const noexcept
Returns the current debug level.
Definition: DebugStream.h:84