97 const
char* _name{
nullptr};
105 std::array<bool, 4> _enabledLevels{
true,
true,
true,
true};
114 Private* _d{
nullptr};
156 _buffer << std::boolalpha;
195 if constexpr (std::is_base_of_v<std::string, std::decay_t<T>>)
200 else if constexpr (std::is_base_of_v<QString, std::decay_t<T>>)
239 return _buffer.str();
249 std::ostringstream _buffer;
285 const char* _file{
nullptr};
287 const char* _function{
nullptr};
308#define SF_DECLARE_LOGGING_CATEGORY(name) static const sf::LoggingCategory& name();
314#define SF_LOGGING_CATEGORY(name, stringName) \
315 static const sf::LoggingCategory& name() \
317 static const sf::LoggingCategory category(stringName); \
321#define SF_MESSAGE_LOGGER_COMMON(category, level) \
322 if (category().isEnabled(level)) \
323 sf::LogMessage(level, category(), __FILE__, __LINE__, __func__).stream()
325#ifndef SF_NO_DEBUG_OUTPUT
326 #define sfCDebug(category) SF_MESSAGE_LOGGER_COMMON(category, sf::LogLevel::Debug)
328 #define sfCDebug(category) \
330 sf::LogMessageVoidify() & sf::LogMessage(sf::LogLevel::Debug, category(), __FILE__, __LINE__, __func__).stream()
333#ifndef SF_NO_INFO_OUTPUT
334 #define sfCInfo(category) SF_MESSAGE_LOGGER_COMMON(category, sf::LogLevel::Info)
336 #define sfCInfo(category) \
338 sf::LogMessageVoidify() & sf::LogMessage(sf::LogLevel::Info, category(), __FILE__, __LINE__, __func__).stream()
341#ifndef SF_NO_WARNING_OUTPUT
342 #define sfCWarning(category) SF_MESSAGE_LOGGER_COMMON(category, sf::LogLevel::Warning)
344 #define sfCWarning(category) \
346 sf::LogMessageVoidify() & sf::LogMessage(sf::LogLevel::Warning, category(), __FILE__, __LINE__, __func__).stream()
349#define sfCCritical(category) SF_MESSAGE_LOGGER_COMMON(category, sf::LogLevel::Critical)
Helper structure used to discard stripped log expressions at compile time.
Definition logger.h:295
void operator&(const T &value) const noexcept
Definition logger.h:298
LogStream & stream() noexcept
Returns the underlying stream buffer for chained logging.
Definition logger.h:277
LogMessage & operator=(const LogMessage &)=delete
~LogMessage()
Destructor. Flushes buffered message to backend / handlers.
LogMessage(const LogMessage &)=delete
LogMessage(LogMessage &&)=delete
LogMessage(LogLevel level, const LoggingCategory &category, const char *file, int line, const char *function)
Constructs a log message context.
LogMessage & operator=(LogMessage &&)=delete
Stream buffer helper for formatted logging output.
Definition logger.h:149
LogStream & operator<<(std::ios_base &(*manip)(std::ios_base &))
Stream insertion operator for ios_base manipulators (e.g. std::hex).
Definition logger.h:228
void escapeString(const std::string &str)
Escape a string by adding escape characters.
LogStream & operator=(const LogStream &)=delete
Copy assignment operator deleted to prevent accidental copying.
LogStream & operator<<(const T &value)
Stream insertion operator for general types.
Definition logger.h:193
std::string str() const
Returns the accumulated formatted string.
Definition logger.h:237
~LogStream()=default
Destructor.
LogStream & operator<<(std::ostream &(*manip)(std::ostream &))
Stream insertion operator for ostream manipulators (e.g. std::endl).
Definition logger.h:219
LogStream(const LogStream &&)=delete
Move constructor deleted to prevent accidental copying.
LogStream & operator=(const LogStream &&)=delete
Move assignment operator deleted to prevent accidental copying.
LogStream()
Constructs a log stream with default formatting options.
Definition logger.h:154
LogStream & nospace()
Definition logger.h:242
LogStream(const LogStream &)=delete
Copy constructor deleted to prevent accidental copying.
Represents a category used for logging purposes. Provides a way to group and control log messages bas...
Definition logger.h:51
LoggingCategory & operator=(LoggingCategory &&)=delete
LoggingCategory(const LoggingCategory &)=delete
~LoggingCategory()
Destructor. Releases internal bridge resources if allocated.
LoggingCategory(const char *name)
Constructs a logging category with the given unique name.
LoggingCategory(LoggingCategory &&)=delete
void setEnabled(LogLevel level, bool enable) noexcept
Dynamically enables or disables a specific log level for this category.
bool isEnabled(LogLevel level) const noexcept
Checks if a specific log level is enabled for this category.
LoggingCategory & operator=(const LoggingCategory &)=delete
const char * categoryName() const noexcept
Gets the category name string.
#define _LOG_CLASS
Definition log/global.h:35
#define _LOG_FUNC
Definition log/global.h:34
Definition Application.h:10
LogLevel
Severity levels for logging output.
Definition logger.h:37
@ Warning
Definition logger.h:40
@ Critical
Definition logger.h:41
@ Info
Definition logger.h:39
@ Debug
Definition logger.h:38
TARGET_IMPORT LogHandler installLogHandler(LogHandler handler)
Installs a custom message handler callback.
TARGET_IMPORT void setLogMessagePattern(const std::string &pattern)
Sets the pattern for formatting log messages. This method configures the format used to display log m...
TARGET_IMPORT LogHandler defaultLogHandler()
Gets the default log message handler.
void(*)(LogLevel level, const LogLocation &location, const std::string &message) LogHandler
Custom log message handler callback type.
Definition logger.h:131
Source code location metadata captured during log message generation.
Definition logger.h:121
int line
Definition logger.h:123
const char * categoryName
Definition logger.h:125
const char * function
Definition logger.h:124
const char * file
Definition logger.h:122