ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
Logger.hpp File Reference

Lightweight, replaceable logging facility used across ZenitUI. More...

#include "Common.hpp"
#include <cstdio>

Go to the source code of this file.

Classes

struct  ZenitUI::LogMessage
 A single log record passed to ILogger::log. More...
class  ZenitUI::ILogger
 Abstract sink for LogMessage records. More...
class  ZenitUI::ConsoleLogger
 Default ILogger that prints to stderr. More...
class  ZenitUI::Logger
 Global registry for the active logger. More...

Enumerations

enum class  ZenitUI::LogLevel { Debug , Info , Warning , Error }
 Severity level attached to a LogMessage.

Functions

void ZenitUI::logImpl (LogLevel level, const std::string &cat, const std::string &file, int line, int col, const std::string &text)
 Internal dispatch: build a LogMessage and forward it to the active logger.
void ZenitUI::logDebug (const std::string &c, const std::string &f, int l, int col, const std::string &t)
void ZenitUI::logInfo (const std::string &c, const std::string &f, int l, int col, const std::string &t)
void ZenitUI::logWarn (const std::string &c, const std::string &f, int l, int col, const std::string &t)
void ZenitUI::logError (const std::string &c, const std::string &f, int l, int col, const std::string &t)

Detailed Description

Lightweight, replaceable logging facility used across ZenitUI.

The logger is intentionally minimal: a single global ILogger sink that receives LogMessage records. Applications can replace the default ConsoleLogger with their own implementation by calling Logger::set.

Free functions logDebug, logInfo, logWarn, logError are the intended entry points. They take the source location as explicit parameters so the macros that use them can inject __FILE__, __LINE__, etc. without polluting the call site.