Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
logger.h File Reference
#include "global.h"
#include <array>
#include <iomanip>
#include <ios>
#include <ostream>
#include <sstream>
#include <string>
#include <cstdint>
Include dependency graph for logger.h:

Go to the source code of this file.

Classes

class  sf::LoggingCategory
 Represents a category used for logging purposes. Provides a way to group and control log messages based on different categories. It can be useful for filtering log output and applying specific logging levels to different parts of an application. More...
struct  sf::LogLocation
 Source code location metadata captured during log message generation. More...
class  sf::LogStream
 Stream buffer helper for formatted logging output. More...
class  sf::LogMessage
 Log message lifecycle container that flushes buffered output on destruction. More...
class  sf::LogMessageVoidify
 Helper structure used to discard stripped log expressions at compile time. More...

Namespaces

namespace  sf

Macros

#define SF_DECLARE_LOGGING_CATEGORY(name)
 Declares a logging category accessor function.
#define SF_LOGGING_CATEGORY(name, stringName)
 Defines and instantiates a static logging category.
#define SF_MESSAGE_LOGGER_COMMON(category, level)
#define sfCDebug(category)
#define sfCInfo(category)
#define sfCWarning(category)
#define sfCCritical(category)

Typedefs

using sf::LogHandler = void (*)(LogLevel level, const LogLocation& location, const std::string& message)
 Custom log message handler callback type.

Enumerations

enum class  sf::LogLevel : uint8_t { sf::Debug = 0 , sf::Info , sf::Warning , sf::Critical }
 Severity levels for logging output. More...

Functions

TARGET_IMPORT void sf::setLogMessagePattern (const std::string &pattern)
 Sets the pattern for formatting log messages. This method configures the format used to display log messages. The format can include specific placeholders in the form of '%{token}' that determine the structure and content of log output. Available tokens: 'type', 'file', 'line', 'category', 'message' and 'time'. Where time is the timestamp of the log message and formatted using the std::put_time() formatting. Since milliseconds are not included in the std::put_time() formatting, milliseconds are appended to the formatted time when the format ends with a '.'.
TARGET_IMPORT LogHandler sf::installLogHandler (LogHandler handler)
 Installs a custom message handler callback.
TARGET_IMPORT LogHandler sf::defaultLogHandler ()
 Gets the default log message handler.

Macro Definition Documentation

◆ SF_DECLARE_LOGGING_CATEGORY

#define SF_DECLARE_LOGGING_CATEGORY ( name)
Value:
static const sf::LoggingCategory& name();
Represents a category used for logging purposes. Provides a way to group and control log messages bas...
Definition logger.h:51

Declares a logging category accessor function.

◆ SF_LOGGING_CATEGORY

#define SF_LOGGING_CATEGORY ( name,
stringName )
Value:
static const sf::LoggingCategory& name() \
{ \
static const sf::LoggingCategory category(stringName); \
return category; \
}

Defines and instantiates a static logging category.

◆ SF_MESSAGE_LOGGER_COMMON

#define SF_MESSAGE_LOGGER_COMMON ( category,
level )
Value:
if (category().isEnabled(level)) \
sf::LogMessage(level, category(), __FILE__, __LINE__, __func__).stream()

◆ sfCCritical

#define sfCCritical ( category)
Value:
#define SF_MESSAGE_LOGGER_COMMON(category, level)
Definition logger.h:321
@ Critical
Definition logger.h:41

◆ sfCDebug

#define sfCDebug ( category)
Value:
@ Debug
Definition logger.h:38

◆ sfCInfo

#define sfCInfo ( category)
Value:
@ Info
Definition logger.h:39

◆ sfCWarning

#define sfCWarning ( category)
Value:
@ Warning
Definition logger.h:40