41 std::size_t
addGroup(std::string_view groupName, std::string_view category =
"");
46 std::vector<LogGroup> m_groups;
74std::size_t
add_log_group(std::string_view groupName, std::string_view category =
"");
87#define PH_DECLARE_LOG_GROUP(groupName)\
88 const ::ph::Logger& internal_impl_logger_access_##groupName()
92#define PH_DEFINE_LOG_GROUP(groupName, category)\
93 const ::ph::Logger& internal_impl_logger_access_##groupName()\
95 static const std::size_t logGroupIndex = ::ph::detail::core_logging::add_log_group(#groupName, #category);\
97 return ::ph::detail::core_logging::get_logger();\
100#define PH_DEFINE_INLINE_LOG_GROUP(groupName, category)\
101 inline const ::ph::Logger& internal_impl_logger_access_##groupName()\
103 static const std::size_t logGroupIndex = ::ph::detail::core_logging::add_log_group(#groupName, #category);\
105 return ::ph::detail::core_logging::get_logger();\
111#define PH_DEFINE_INTERNAL_LOG_GROUP(groupName, category)\
114 PH_DEFINE_INLINE_LOG_GROUP(groupName, category);\
120#define PH_DEFINE_EXTERNAL_LOG_GROUP(groupName, category) PH_DEFINE_INLINE_LOG_GROUP(groupName, category)
122#define PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, level, rawStringExpr)\
125 constexpr auto logLevel = ::ph::ELogLevel::level;\
126 const auto rawString = rawStringExpr;\
127 if constexpr(::ph::is_once(logLevel))\
129 static const bool PH_CONCAT_2(dummy, __LINE__) = [&]()\
131 ::ph::detail::core_logging::log_to_logger(\
132 internal_impl_logger_access_##groupName(),\
141 ::ph::detail::core_logging::log_to_logger(\
142 internal_impl_logger_access_##groupName(),\
153#define PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, level, formatString, ...)\
154 PH_LOG_RAW_STRING_TO_CORE_LOGGER(\
157 std::format(formatString __VA_OPT__(,) __VA_ARGS__))
159#if PH_ENABLE_DEBUG_LOG
160 #define PH_DEBUG_LOG_STRING(groupName, rawString) PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, Debug, rawString)
161 #define PH_DEBUG_LOG_STRING_ONCE(groupName, rawString) PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, DebugOnce, rawString)
162 #define PH_DEBUG_LOG(groupName, formatString, ...) PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, Debug, formatString, __VA_ARGS__)
163 #define PH_DEBUG_LOG_ONCE(groupName, formatString, ...) PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, DebugOnce, formatString, __VA_ARGS__)
165 #define PH_DEBUG_LOG_STRING(groupName, rawString) PH_NO_OP()
166 #define PH_DEBUG_LOG_STRING_ONCE(groupName, rawString) PH_NO_OP()
167 #define PH_DEBUG_LOG(groupName, formatString, ...) PH_NO_OP()
168 #define PH_DEBUG_LOG_ONCE(groupName, formatString, ...) PH_NO_OP()
171#define PH_LOG_STRING(groupName, level, rawString) PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, level, rawString)
172#define PH_LOG(groupName, level, formatString, ...) PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, level, formatString, __VA_ARGS__)
185#if PH_ENABLE_DEBUG_LOG
186 #define PH_DEFAULT_DEBUG_LOG_STRING(rawString) PH_DEBUG_LOG_STRING(PhotonRenderer, rawString)
187 #define PH_DEFAULT_DEBUG_LOG_STRING_ONCE(rawString) PH_DEBUG_LOG_STRING_ONCE(PhotonRenderer, rawString)
188 #define PH_DEFAULT_DEBUG_LOG(formatString, ...) PH_DEBUG_LOG(PhotonRenderer, formatString, __VA_ARGS__)
189 #define PH_DEFAULT_DEBUG_LOG_ONCE(formatString, ...) PH_DEBUG_LOG_ONCE(PhotonRenderer, formatString, __VA_ARGS__)
191 #define PH_DEFAULT_DEBUG_LOG_STRING(rawString, ...) PH_NO_OP()
192 #define PH_DEFAULT_DEBUG_LOG_STRING_ONCE(rawString, ...) PH_NO_OP()
193 #define PH_DEFAULT_DEBUG_LOG(formatString, ...) PH_NO_OP()
194 #define PH_DEFAULT_DEBUG_LOG_ONCE(formatString, ...) PH_NO_OP()
197#define PH_DEFAULT_LOG_STRING(level, rawString) PH_LOG_STRING(PhotonRenderer, level, rawString)
198#define PH_DEFAULT_LOG(level, formatString, ...) PH_LOG(PhotonRenderer, level, formatString, __VA_ARGS__)
LogGroups & operator=(const LogGroups &rhs)=default
LogGroups(const LogGroups &other)=default
const LogGroup & getGroup(std::size_t index) const
Definition logging.cpp:167
std::size_t numGroups() const
Definition logging.cpp:162
std::size_t addGroup(std::string_view groupName, std::string_view category="")
Definition logging.cpp:156
Configurations for the entire toolset.
#define PH_DECLARE_LOG_GROUP(groupName)
Declares a logger. The logger should be defined using PH_DEFINE_LOG_GROUP() somewhere in the source (...
Definition logging.h:87
Useful macro definitions for general operations.
Core logging functionalities. Most logs will output information (logs) via a main logger,...
Definition logging.h:54
std::size_t add_log_group(std::string_view groupName, std::string_view category="")
Add a log group to the core logger.
Definition logging.cpp:134
Logger & get_logger()
Get the core logger.
Definition logging.cpp:126
void log_to_logger(const Logger &logger, std::string_view groupName, ELogLevel logLevel, std::string_view logMessage)
Log information to the specified logger.
Definition logging.cpp:144
void init()
Initializes core logging functionalities. Any logging is only valid after calling init().
Definition logging.cpp:79
void exit()
Terminates core logging functionalities. Cleanup after logging is finished.
Definition logging.cpp:114
The root for all renderer implementations.
Definition assertion.h:9
LogGroups get_core_log_groups()
Definition logging.cpp:174
ELogLevel
Definition ELogLevel.h:9
std::string category
Definition logging.h:31
std::string groupName
Definition logging.h:30