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);
155 explicit Channel(
char const* label,
const subscribers_t& subscribers);
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;
168 subscribers_t subscribers_;
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); \
HPP_UTIL_DLLAPI int getVerbosityLevel()
Get the verbosity level.
Definition: debug.cc:125
constexpr int warning
Definition: debug.hh:95
JournalOutput benchmarkJournal
Logs to benchmark journal file (i.e. benchmark.XXX.log).
Definition: debug.hh:213
constexpr int benchmark
Definition: debug.hh:98
Definition: assertion.hh:45
Channel info
Technical information and debugging.
Definition: debug.hh:225
constexpr int error
Definition: debug.hh:94
Logging in journal file in the logging directory.
Definition: debug.hh:172
std::vector< Output * > subscribers_t
Definition: debug.hh:153
Channel notice
User-oriented information.
Definition: debug.hh:222
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
Channel benchmark
Benchmark information.
Definition: debug.hh:228
HPP_UTIL_DLLAPI void enableBenchmark(bool enable)
Definition: debug.cc:131
Debugging output.
Definition: debug.hh:125
#define HPP_UTIL_DLLAPI
Definition: config.hh:88
Channel warning
Non-fatal problems channel.
Definition: debug.hh:219
HPP_UTIL_DLLAPI bool isBenchmarkEnabled()
Definition: debug.cc:129
Channel error
Fatal problems channel.
Definition: debug.hh:216
HPP_UTIL_DLLAPI Logging logging
Benchmark information.
Definition: debug.cc:270
Logging in console (std::cerr).
Definition: debug.hh:192
constexpr int notice
Definition: debug.hh:96
Receive debugging information.
Definition: debug.hh:151
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
constexpr int none
Definition: debug.hh:93
Logging class owns all channels and outputs.
Definition: debug.hh:203
constexpr int info
Definition: debug.hh:97
bool isChannelEnabled(int channel)
Definition: debug.hh:111
HPP_UTIL_DLLAPI std::string getPrefix(const std::string &packageName)
Compute the logging prefix.
Definition: debug.cc:99
HPP_UTIL_DLLAPI void setVerbosityLevel(int level)
Set the verbosity level.
Definition: debug.cc:127