#include <iostream>
#include "Logger.h"
Go to the source code of this file.
void assertOrDie |
( |
bool |
condition, |
|
|
std::string |
message |
|
) |
| |
Definition at line 37 of file LoggerUnitTest.cpp.
Referenced by main().
39 std::cerr <<
"Assert failed: " << message << std::endl;
Definition at line 44 of file LoggerUnitTest.cpp.
References assertOrDie(), DEBUG, ERROR, FATAL, logger, loggerOutput, LoggerOutput::onDebug, LoggerOutput::onError, LoggerOutput::onFatal, LoggerOutput::onInfo, LoggerOutput::onVerbose, LoggerOutput::onWarn, unitLogger, and WARN.
46 bool hasLogged =
false;
47 std::string lastMessage;
48 std::string lastModule;
49 auto tmpLogger = [&](std::string module, std::string msg) {
68 assertOrDie(lastMessage ==
"Mweh. x = 3",
"Substitution gone wrong!");
75 assertOrDie(lastMessage ==
"Escapes are possible! 100.01% sure!",
"Escape gone wrong!");
79 assertOrDie(lastModule ==
"UnitTester",
"Module was incorrect!");
81 assertOrDie(lastModule !=
"UnitTester",
"Module was incorrect!");
LL< Log::DEBUG > DEBUG
Debug information.
std::function< void(std::string, std::string)> onWarn
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
std::function< void(std::string, std::string)> onVerbose
LL< Log::ERROR > ERROR
Error log level.
LL< Log::WARN > WARN
Warning log level.
std::function< void(std::string, std::string)> onError
void assertOrDie(bool condition, std::string message)
LL< Log::FATAL > FATAL
Fatal log level.
LoggerOutput * loggerOutput
Declaration of the output functions. If the output needs to be redirected, please swap the loggerOutp...
std::function< void(std::string, std::string)> onDebug
std::function< void(std::string, std::string)> onInfo
Logger< HG_LOGLEVEL_SELFTEST > unitLogger("UnitTester")
std::function< void(std::string, std::string)> onFatal