Debug log example

This commit is contained in:
2025-06-30 20:16:27 -04:00
parent e0eb274d8b
commit 0b7fe2ccfc
2 changed files with 22 additions and 0 deletions

View File

@@ -83,6 +83,8 @@ namespace Mutil::Logging {
};
};
/*
class Info : public LoggerObj {
public:

View File

@@ -1,6 +1,19 @@
#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();
};
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());
};
};
int main() {
std::function<std::string()> λprefix = [] {
@@ -16,12 +29,19 @@ int main() {
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();
//Desktop::Browser::OpenURL("https://git.redacted.cc/maxine/mutil");
//Mutil::Console::Graphics::SGARG a = Mutil::Console::Graphics::TextStyle::Underline
}