Repository navigation
v0.1.0
v0.1.0
Testing
Test programs for this release.
#include "moody/Loggr.hpp"
using namespace moody;
int main (){
struct Test{
double two;
int one;
};
Test test {13.3, 7};
int x = 1337;
double y = 9.4;
std::string host = "bubba94";
Loggr loggr("logs", "test", "output.txt", true, false, true);
// No variables provided is used for outputting info.
loggr.log(moody::Loggr::Level::INFO, "CLIENT", "TESTING", {__FILE__, __LINE__});
// Variable arguments are sent in pairs
// Value of varaible: x
loggr.log(moody::Loggr::Level::TRACE, "APP", "TESTING", {__FILE__, __LINE__}, "x", x);
// Values of variables: test.one, test.two
loggr.log(moody::Loggr::Level::DEBUG, "RENDERER", "TESTING", {__FILE__, __LINE__}, "test.two", test.two, "test.one", test.one);
// Value of variable: name
loggr.log(moody::Loggr::Level::WARN, "GRAPHICS", "TESTING", {__FILE__, __LINE__}, "host", z);
// Value of varaible: y
loggr.log(moody::Loggr::Level::ERROR, "TEXTURE", "TESTING", {__FILE__, __LINE__}, "y", y);
// Adress of variable: y
loggr.log(moody::Loggr::Level::FATAL, "CONFIG", "TESTING", {__FILE__, __LINE__}, "&y", &y);
return 0;
}Output from above program
The terminal window will add matching coloring
<timestamp> [ INFO] [ CLIENT ] in:test.cpp(20) msg:{TESTING}
<timestamp> [TRACE] [ APP ] in:test.cpp(21) var:{x=1337} msg:{TESTING}
<timestamp> [DEBUG] [ RENDERER ] in:test.cpp(22) vars:{test.one=13.3:test.two=7} msg:{TESTING}
<timestamp> [ WARN] [ GRAPHICS ] in:test.cpp(23) var:{name=bubba94} msg:{TESTING}
<timestamp> [ERROR] [ TEXTURE ] in:test.cpp(24) var:{y=9.4} msg:{TESTING}
<timestamp> [FATAL] [ CONFIG ] in:test.cpp(25) var:{&y=<address>} msg:{TESTING}