34#ifndef HPP_UTIL_DEBUG_HH
35#define HPP_UTIL_DEBUG_HH
90 const std::string& packageName);
92namespace verbosityLevel {
131 char const* function,
const std::string& data) = 0;
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; \
255#define hppDebugStatement(statement) statement
266#define hppDout(channel, data) \
268 using namespace hpp; \
269 using namespace ::hpp::debug; \
270 if (isChannelEnabled(verbosityLevel::channel)) { \
271 std::stringstream __ss; \
272 __ss << data << iendl; \
273 logging.channel.write(__FILE__, __LINE__, __PRETTY_FUNCTION__, __ss); \
281#define hppDoutFatal(channel, data) \
283 using namespace hpp; \
284 using namespace ::hpp::debug; \
285 std::stringstream __ss; \
286 __ss << data << iendl; \
287 logging.channel.write(__FILE__, __LINE__, __PRETTY_FUNCTION__, __ss); \
288 ::std::exit(EXIT_FAILURE); \
295#define hppDebug(statement) \
298#define hppDebugStatement(statement)
299#define hppDout(channel, data) \
302#define hppDoutFatal(channel, data) \
304 using namespace hpp; \
305 ::std::cerr << data << iendl; \
306 ::std::exit(EXIT_FAILURE); \
Receive debugging information.
Definition debug.hh:151
std::vector< Output * > subscribers_t
Definition debug.hh:153
Logging in console (std::cerr).
Definition debug.hh:192
Logging in journal file in the logging directory.
Definition debug.hh:172
Logging class owns all channels and outputs.
Definition debug.hh:203
Channel info
Technical information and debugging.
Definition debug.hh:225
Channel notice
User-oriented information.
Definition debug.hh:222
Channel error
Fatal problems channel.
Definition debug.hh:216
Channel warning
Non-fatal problems channel.
Definition debug.hh:219
ConsoleOutput console
Logs to console (i.e. stderr).
Definition debug.hh:209
JournalOutput journal
Logs to main journal file (i.e. journal.XXX.log).
Definition debug.hh:211
JournalOutput benchmarkJournal
Logs to benchmark journal file (i.e. benchmark.XXX.log).
Definition debug.hh:213
Channel benchmark
Benchmark information.
Definition debug.hh:228
Debugging output.
Definition debug.hh:125
virtual void write(const Channel &channel, char const *file, int line, char const *function, const std::string &data)=0
virtual void write(const Channel &channel, char const *file, int line, char const *function, const std::stringstream &data)=0
#define HPP_UTIL_DLLAPI
Definition config.hh:88
constexpr int notice
Definition debug.hh:96
constexpr int info
Definition debug.hh:97
constexpr int error
Definition debug.hh:94
constexpr int warning
Definition debug.hh:95
constexpr int benchmark
Definition debug.hh:98
constexpr int none
Definition debug.hh:93
HPP_UTIL_DLLAPI void setVerbosityLevel(int level)
Set the verbosity level.
Definition debug.cc:127
HPP_UTIL_DLLAPI Logging logging
Benchmark information.
Definition debug.cc:270
bool isChannelEnabled(int channel)
Definition debug.hh:111
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:116
HPP_UTIL_DLLAPI int getVerbosityLevel()
Get the verbosity level.
Definition debug.cc:125
HPP_UTIL_DLLAPI void enableBenchmark(bool enable)
Definition debug.cc:131
HPP_UTIL_DLLAPI bool isBenchmarkEnabled()
Definition debug.cc:129
HPP_UTIL_DLLAPI std::string getPrefix(const std::string &packageName)
Compute the logging prefix.
Definition debug.cc:99
Definition assertion.hh:45