|
UniSet
2.2.1
|
#include <DebugStream.h>
Классы | |
| struct | debugstream_internal |
| So that public parts of DebugStream does not need to know about filebuf. Подробнее... | |
Открытые типы | |
|
typedef sigc::signal< void, const std::string & > | StreamEvent_Signal |
Открытые члены | |
| DebugStream (Debug::type t=Debug::NONE) | |
| Constructor, sets the debug level to t. | |
| DebugStream (char const *f, Debug::type t=Debug::NONE, bool truncate=false) | |
| Constructor, sets the log file to f, and the debug level to t. | |
| StreamEvent_Signal | signal_stream_event () |
| void | level (Debug::type t) |
| Sets the debug level to t. | |
| Debug::type | level () const |
| Returns the current debug level. | |
| void | addLevel (Debug::type t) |
| Adds t to the current debug level. | |
| void | delLevel (Debug::type t) |
| Deletes t from the current debug level. | |
| virtual void | logFile (const std::string &f, bool truncate=false) |
| Sets the debugstreams' logfile to f. | |
| std::string | getLogFile () |
| void | setLogFile (const std::string &n) |
| bool | isOnLogFile () |
| void | onLogFile (bool truncate=false) |
| void | offLogFile () |
| bool | debugging (Debug::type t=Debug::ANY) const |
| Returns true if t is part of the current debug level. | |
| std::ostream & | debug (Debug::type t=Debug::ANY) |
| std::ostream & | operator[] (Debug::type t) |
| std::ostream & | to_end (Debug::type t) |
| std::ostream & | operator() (Debug::type t) |
| void | showDateTime (bool s) |
| void | showLogType (bool s) |
| std::ostream & | log (Debug::type l) |
| std::ostream & | printDate (Debug::type t, char brk= '/') |
| std::ostream & | printTime (Debug::type t, char brk= ':') |
| std::ostream & | printDateTime (Debug::type t) |
| std::ostream & | pos (int x, int y) |
| const DebugStream & | operator= (const DebugStream &r) |
| void | setLogName (const std::string &n) |
| std::string | getLogName () |
Защищенные члены | |
| void | sbuf_overflow (const std::string &s) |
Защищенные данные | |
| Debug::type | dt = { Debug::NONE } |
| The current debug level. | |
| std::ostream | nullstream |
| The no-op stream. | |
| debugstream_internal * | internal = { 0 } |
| bool | show_datetime = { true } |
| bool | show_logtype = { true } |
| std::string | fname = { "" } |
| StreamEvent_Signal | s_stream |
| std::string | logname = { "" } |
| bool | isWriteLogFile = { false } |
DebugStream is a ostream intended for debug output. It has also support for a logfile. Debug output is output to cerr and if the logfile is set, to the logfile.
Example of Usage: DebugStream debug; debug.level(Debug::INFO); debug.debug(Debug::WARN) << "WARN\n"; debug[Debug::INFO] << "INFO\n"; debug << "Always\n";
Will output: INFO Always
If you want to have debug output from time critical code you should use this construct: if (debug..is_info()) { debug << "...debug output...\n"; }
To give debug info even if no debug (NONE) is requested: debug << "... always output ...\n";
To give debug output regardless of what debug level is set (!NONE): debug.debug() << "...on debug output...\n"; debug[Debug::ANY] << "...on debug output...\n";
To give debug output when a specific debug level is set (INFO): debug.debug(Debug::INFO) << "...info...\n"; debug[Debug::INFO] << "...info...\n";
To give debug output when either on of debug levels is set (INFO or CRIT): debug.debug(Debug::type(Debug::INFO | Debug::CRIT)) << "...info/crit...\n"; debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
| DebugStream::DebugStream | ( | Debug::type | t = Debug::NONE | ) | [explicit] |
Constructor, sets the debug level to t.
| DebugStream::DebugStream | ( | char const * | f, |
| Debug::type | t = Debug::NONE, |
||
| bool | truncate = false |
||
| ) | [explicit] |
Constructor, sets the log file to f, and the debug level to t.
| void DebugStream::addLevel | ( | Debug::type | t | ) | [inline] |
Adds t to the current debug level.
| std::ostream & DebugStream::debug | ( | Debug::type | t = Debug::ANY | ) |
Returns the no-op stream if t is not part of the current debug level otherwise the real debug stream is used.
Перекрестные ссылки dt и nullstream.
| bool DebugStream::debugging | ( | Debug::type | t = Debug::ANY | ) | const [inline] |
Returns true if t is part of the current debug level.
| void DebugStream::delLevel | ( | Debug::type | t | ) | [inline] |
Deletes t from the current debug level.
| void DebugStream::level | ( | Debug::type | t | ) | [inline] |
Sets the debug level to t.
| Debug::type DebugStream::level | ( | ) | const [inline] |
Returns the current debug level.
| void DebugStream::logFile | ( | const std::string & | f, |
| bool | truncate = false |
||
| ) | [virtual] |
Sets the debugstreams' logfile to f.
Переопределяется в LogAgregator.
Перекрестные ссылки DebugStream::debugstream_internal::fbuf.
Используется в LogAgregator::logFile().
| std::ostream & DebugStream::operator() | ( | Debug::type | t | ) |
Вывод продолжения логов (без даты и времени) "log()"
Перекрестные ссылки dt и nullstream.
| std::ostream& DebugStream::operator[] | ( | Debug::type | t | ) | [inline] |
This is an operator to give a more convenient use: dbgstream[Debug::INFO] << "Info!\n"; Вывод осуществляется с датой и временем (если они не отключены)
| std::ostream& DebugStream::to_end | ( | Debug::type | t | ) | [inline] |
Вывод продолжения логов (без даты и времени)
Debug::type DebugStream::dt = { Debug::NONE } [protected] |
The current debug level.
Используется в debug() и operator()().
std::ostream DebugStream::nullstream [protected] |
The no-op stream.
Используется в debug() и operator()().
1.7.6.1