Files
jlog/main.cpp
2024-08-13 15:03:15 -04:00

81 lines
2.0 KiB
C++

// Josh's Logger
// Minimal, robust, Modern (C++20) Logging Framework
// Created by Joshua O'Leary @ Redacted Software, June 2024
// Contact: josh@redacted.cc
// Contributors: william@redacted.cc maxi@redacted.cc
// This work is dedicated to the public domain.
#include <jlog/jlog.hpp>
#include <jlog/io.hpp>
#include <mcolor.h>
int main()
{
using namespace mcolor;
jlog::info("This dick 1");
jlog::debug("This dick 1");
jlog::verbose("This dick 1");
jlog::warning("This dick 1");
jlog::error("This dick 1");
jlog::fatal("This dick 1");
jlog::SetTracebackOnGlobalLoggers(false);
jlog::info.SetTraceback(true);
jlog::debug.SetTraceback(true);
jlog::verbose.SetTraceback(true);
jlog::info("This dick 2");
jlog::debug("This dick 2");
jlog::verbose("This dick 2");
jlog::warning("This dick 2");
jlog::error("This dick 2");
jlog::fatal("This dick 2");
jlog::info.Disable();
jlog::info("This dick 3");
jlog::debug("This dick 3");
jlog::verbose("This dick 3");
jlog::warning("This dick 3");
jlog::error("This dick 3");
jlog::fatal("This dick 3");
jlog::info.Enable();
jlog::SetTracebackOnGlobalLoggers(false);
jlog::info("This dick 4");
jlog::info.OnLogEvent += [](std::vector<jlog::token> t) {
jlog::token dbg = {.colorCode = jlog::debug.GetColorCode(), .content = "This message is only seen when the event is called."};
jlog::log_to_console(jlog::toks2consoleMsg(std::vector<jlog::token>{dbg}));
};
jlog::info("This dick 4");
jlog::info.OnLogEvent += [](std::vector<jlog::token> t) {
jlog::token dbg = {.colorCode = jlog::debug.GetColorCode(), .content = "This is the 2nd event message"};
jlog::log_to_console(jlog::toks2consoleMsg(std::vector<jlog::token>{dbg}));
};
jlog::info("This dick 4");
jlog::info.SetTraceback(true);
jlog::info("This dick 4");
return 0;
}
//Windows :(
#ifdef _WIN32
extern "C" {
int wmain(int argc, wchar_t* argv[]) {
return main();
}
}
#endif