65 lines
3.0 KiB
C++
65 lines
3.0 KiB
C++
#include <Logging.hpp>
|
|
#include <Desktop.hpp>
|
|
#include <Console.hpp>
|
|
#include <source_location>
|
|
|
|
class Debug : public Mutil::Logging::LoggerObj {
|
|
static std::string λMessage(std::string m) {
|
|
return Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RItalic, 135).Compile() + std::format("[D] {}", m) + Mutil::Console::Graphics::Rendition().Compile();
|
|
//return Mutil::Console::Graphics::String(std::format("[D] {}", m), {Mutil::Console::Graphics::RItalic, 135}).Render();
|
|
};
|
|
public:
|
|
Debug() : LoggerObj(std::cout, nullptr, λMessage, nullptr) {};
|
|
void Trace(const std::source_location &location = std::source_location::current()) {
|
|
Mutil::Console::Graphics::Rendition r(Mutil::Console::Graphics::RBold, 241);
|
|
|
|
this->operator()("{}{} @ {}:{}", r.Compile(), location.function_name(), location.file_name(), location.line());
|
|
//this->operator()(Mutil::Console::Graphics::String(
|
|
// std::format("{} @ {}:{}", location.function_name(), location.file_name(), location.line()),
|
|
// {Mutil::Console::Graphics::RBold, 241}).Render());
|
|
};
|
|
};
|
|
|
|
int main() {
|
|
std::function<std::string()> λprefix = [] {
|
|
return Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RItalic, 252, 186, 3).Compile() + "--> " + Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RNormal).Compile();
|
|
};
|
|
std::function<std::string(const std::string)> λmessage = [](const std::string m) {
|
|
return Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RUnderline, 74).Compile() + m + Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RNormal).Compile();
|
|
};
|
|
//std::function<std::string()> λsuffix = [] {
|
|
// return " 0";
|
|
//};
|
|
|
|
Mutil::Logging::LoggerObj l(std::cout, λprefix, λmessage, nullptr);
|
|
|
|
l("Hello world");
|
|
l << "something" << "something." << "something..";
|
|
Mutil::Console::Graphics::Rendition r(Mutil::Console::Graphics::RItalic, 252, 186, 3);
|
|
std::string c = r.Compile();
|
|
std::cout << c << "ass" << std::endl;
|
|
|
|
std::cout << Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RBold | Mutil::Console::Graphics::RItalic, 160, 186, 3).Compile() << "SHIIIIIIT" << Mutil::Console::Graphics::Rendition(Mutil::Console::Graphics::RNormal).Compile() << std::endl;
|
|
|
|
Debug d;
|
|
d << "DEBUGGGGING";
|
|
d.Trace();
|
|
|
|
Mutil::Console::Graphics::Rendition sr(
|
|
Mutil::Console::Graphics::RStrikethrough |
|
|
Mutil::Console::Graphics::RUnderline,
|
|
28);
|
|
|
|
Mutil::Console::Graphics::String s("balls");
|
|
//s.Style({Mutil::Console::Graphics::RBackgroundColor, 69});
|
|
//s.Style();
|
|
|
|
//std::cout << s.Style(sr).Render() << s.Style({Mutil::Console::Graphics::RBackgroundColor, 69}).Render() << std::endl;
|
|
std::cout << s.Render({Mutil::Console::Graphics::RItalic}) << std::endl;
|
|
|
|
|
|
|
|
//Desktop::Browser::OpenURL("https://git.redacted.cc/maxine/mutil");
|
|
//Mutil::Console::Graphics::SGARG a = Mutil::Console::Graphics::TextStyle::Underline
|
|
}
|