hpp-util
5.0.0
Debugging tools for the HPP project.
|
Go to the documentation of this file.
34 #ifndef HPP_UTIL_DEBUG_HH
35 #define HPP_UTIL_DEBUG_HH
90 const std::string& packageName);
92 namespace verbosityLevel {
130 virtual void write(
const Channel& channel,
char const* file,
int line,
131 char const*
function,
const std::string& data) = 0;
133 virtual void write(
const Channel& channel,
char const* file,
int line,
134 char const*
function,
const std::stringstream& data) = 0;
137 std::ostream& writePrefix(std::ostream& stream,
const Channel& channel,
138 char const* file,
int line,
char const*
function);
158 void write(
char const* file,
int line,
char const*
function,
159 const std::string& data);
161 void write(
char const* file,
int line,
char const*
function,
162 const std::stringstream& data);
164 const char* label()
const;
177 void write(
const Channel& channel,
char const* file,
int line,
178 char const*
function,
const std::string& data);
180 void write(
const Channel& channel,
char const* file,
int line,
181 char const*
function,
const std::stringstream& data);
186 std::string filename;
187 std::string lastFunction;
188 std::ofstream stream;
196 void write(
const Channel& channel,
char const* file,
int line,
197 char const*
function,
const std::string& data);
198 void write(
const Channel& channel,
char const* file,
int line,
199 char const*
function,
const std::stringstream& data);
246 #define hppDebug(statement) \
248 using namespace ::hpp::debug; \
253 #define hppDebugStatement(statement) statement
264 #define hppDout(channel, data) \
266 using namespace hpp; \
267 using namespace ::hpp::debug; \
268 if (isChannelEnabled(verbosityLevel::channel)) { \
269 std::stringstream __ss; \
270 __ss << data << iendl; \
271 logging.channel.write(__FILE__, __LINE__, __PRETTY_FUNCTION__, __ss); \
279 #define hppDoutFatal(channel, data) \
281 using namespace hpp; \
282 using namespace ::hpp::debug; \
283 std::stringstream __ss; \
284 __ss << data << iendl; \
285 logging.channel.write(__FILE__, __LINE__, __PRETTY_FUNCTION__, __ss); \
286 ::std::exit(EXIT_FAILURE); \
293 #define hppDebug(statement) \
296 #define hppDebugStatement(statement)
297 #define hppDout(channel, data) \
300 #define hppDoutFatal(channel, data) \
302 using namespace hpp; \
303 ::std::cerr << data << iendl; \
304 ::std::exit(EXIT_FAILURE); \
std::vector< Output * > subscribers_t
Definition: debug.hh:153
constexpr int error
Definition: debug.hh:94
HPP_UTIL_DLLAPI std::string getPrefix(const std::string &packageName)
Compute the logging prefix.
Definition: debug.cc:78
constexpr int warning
Definition: debug.hh:95
Channel notice
User-oriented information.
Definition: debug.hh:222
Channel warning
Non-fatal problems channel.
Definition: debug.hh:219
constexpr int benchmark
Definition: debug.hh:98
Channel benchmark
Benchmark information.
Definition: debug.hh:228
Receive debugging information.
Definition: debug.hh:151
Debugging output.
Definition: debug.hh:125
Channel error
Fatal problems channel.
Definition: debug.hh:216
HPP_UTIL_DLLAPI bool isBenchmarkEnabled()
Definition: debug.cc:108
Channel info
Technical information and debugging.
Definition: debug.hh:225
HPP_UTIL_DLLAPI void enableBenchmark(bool enable)
Definition: debug.cc:110
#define HPP_UTIL_DLLAPI
Definition: config.hh:88
Definition: assertion.hh:45
constexpr int notice
Definition: debug.hh:96
bool isChannelEnabled(int channel)
Definition: debug.hh:111
Logging in journal file in the logging directory.
Definition: debug.hh:172
HPP_UTIL_DLLAPI void setVerbosityLevel(int level)
Set the verbosity level.
Definition: debug.cc:106
HPP_UTIL_DLLAPI std::string getFilename(const std::string &filename, const std::string &packageName)
Compute the path of a file in the logging prefix.
Definition: debug.cc:95
constexpr int none
Definition: debug.hh:93
JournalOutput benchmarkJournal
Logs to benchmark journal file (i.e. benchmark.XXX.log).
Definition: debug.hh:213
constexpr int info
Definition: debug.hh:97
HPP_UTIL_DLLAPI int getVerbosityLevel()
Get the verbosity level.
Definition: debug.cc:104
Logging class owns all channels and outputs.
Definition: debug.hh:203
JournalOutput journal
Logs to main journal file (i.e. journal.XXX.log).
Definition: debug.hh:211
ConsoleOutput console
Logs to console (i.e. stderr).
Definition: debug.hh:209
HPP_UTIL_DLLAPI Logging logging
Benchmark information.
Definition: debug.cc:249
Logging in console (std::cerr).
Definition: debug.hh:192