Photon Common Library 2.0.0-beta
A physically based renderer.
|
Logging functions. More...
#include "Common/Log/logger_fwd.h"
#include "Common/Log/ELogLevel.h"
#include "Common/config.h"
#include "Common/macro.h"
#include <string>
#include <vector>
#include <cstddef>
#include <format>
Go to the source code of this file.
Classes | |
struct | ph::LogGroup |
class | ph::LogGroups |
Namespaces | |
namespace | ph |
The root for all renderer implementations. | |
namespace | ph::detail |
Implementation detail mainly for internal usages. | |
namespace | ph::detail::core_logging |
Core logging functionalities. Most logs will output information (logs) via a main logger, which we refer to as "core logger". This namespace contains implementation details for core logging functionalities. | |
Macros | |
#define | PH_DECLARE_LOG_GROUP(groupName) const ::ph::Logger& internal_impl_logger_access_##groupName() |
Declares a logger. The logger should be defined using PH_DEFINE_LOG_GROUP() somewhere in the source (preferably in a .cpp file). | |
#define | PH_DEFINE_LOG_GROUP(groupName, category) |
Defines a logger. | |
#define | PH_DEFINE_INLINE_LOG_GROUP(groupName, category) |
#define | PH_DEFINE_INTERNAL_LOG_GROUP(groupName, category) |
Defines a logger that is private to a .cpp file. Can only appear one time in a translation unit, preferably in a .cpp file. | |
#define | PH_DEFINE_EXTERNAL_LOG_GROUP(groupName, category) PH_DEFINE_INLINE_LOG_GROUP(groupName, category) |
Defines a public logger in a header file. The logger will be usable anywhere that includes the header file containing this call. | |
#define | PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, level, rawStringExpr) |
#define | PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, level, formatString, ...) |
#define | PH_DEBUG_LOG_STRING(groupName, rawString) PH_NO_OP() |
#define | PH_DEBUG_LOG_STRING_ONCE(groupName, rawString) PH_NO_OP() |
#define | PH_DEBUG_LOG(groupName, formatString, ...) PH_NO_OP() |
#define | PH_DEBUG_LOG_ONCE(groupName, formatString, ...) PH_NO_OP() |
#define | PH_LOG_STRING(groupName, level, rawString) PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, level, rawString) |
#define | PH_LOG(groupName, level, formatString, ...) PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, level, formatString, __VA_ARGS__) |
#define | PH_DEFAULT_DEBUG_LOG_STRING(rawString, ...) PH_NO_OP() |
A set of helper utility macros to log using Photon renderer's default log group. | |
#define | PH_DEFAULT_DEBUG_LOG_STRING_ONCE(rawString, ...) PH_NO_OP() |
#define | PH_DEFAULT_DEBUG_LOG(formatString, ...) PH_NO_OP() |
#define | PH_DEFAULT_DEBUG_LOG_ONCE(formatString, ...) PH_NO_OP() |
#define | PH_DEFAULT_LOG_STRING(level, rawString) PH_LOG_STRING(PhotonRenderer, level, rawString) |
#define | PH_DEFAULT_LOG(level, formatString, ...) PH_LOG(PhotonRenderer, level, formatString, __VA_ARGS__) |
Functions | |
LogGroups | ph::get_core_log_groups () |
void | ph::detail::core_logging::init () |
Initializes core logging functionalities. Any logging is only valid after calling init() . | |
void | ph::detail::core_logging::exit () |
Terminates core logging functionalities. Cleanup after logging is finished. | |
Logger & | ph::detail::core_logging::get_logger () |
Get the core logger. | |
std::size_t | ph::detail::core_logging::add_log_group (std::string_view groupName, std::string_view category="") |
Add a log group to the core logger. | |
void | ph::detail::core_logging::log_to_logger (const Logger &logger, std::string_view groupName, ELogLevel logLevel, std::string_view logMessage) |
Log information to the specified logger. | |
ph::PH_DECLARE_LOG_GROUP (PhotonRenderer) | |
Logging functions.
Note on loggers: All logging functionalities are thread-safe when using pre-defined macros. It is not advisible to log in class dtor, especially for static instances as they may live outside of engine's lifetime. Also make sure not to call any logging functions when the logger is not initialized.
#define PH_DEBUG_LOG | ( | groupName, | |
formatString, | |||
... ) PH_NO_OP() |
#define PH_DEBUG_LOG_ONCE | ( | groupName, | |
formatString, | |||
... ) PH_NO_OP() |
#define PH_DEBUG_LOG_STRING | ( | groupName, | |
rawString ) PH_NO_OP() |
#define PH_DEBUG_LOG_STRING_ONCE | ( | groupName, | |
rawString ) PH_NO_OP() |
#define PH_DECLARE_LOG_GROUP | ( | groupName | ) | const ::ph::Logger& internal_impl_logger_access_##groupName() |
Declares a logger. The logger should be defined using PH_DEFINE_LOG_GROUP()
somewhere in the source (preferably in a .cpp file).
#define PH_DEFAULT_DEBUG_LOG | ( | formatString, | |
... ) PH_NO_OP() |
#define PH_DEFAULT_DEBUG_LOG_ONCE | ( | formatString, | |
... ) PH_NO_OP() |
#define PH_DEFAULT_DEBUG_LOG_STRING | ( | rawString, | |
... ) PH_NO_OP() |
A set of helper utility macros to log using Photon renderer's default log group.
ph
namespace. For general usages, use the custom log group macros. #define PH_DEFAULT_DEBUG_LOG_STRING_ONCE | ( | rawString, | |
... ) PH_NO_OP() |
#define PH_DEFAULT_LOG | ( | level, | |
formatString, | |||
... ) PH_LOG(PhotonRenderer, level, formatString, __VA_ARGS__) |
#define PH_DEFAULT_LOG_STRING | ( | level, | |
rawString ) PH_LOG_STRING(PhotonRenderer, level, rawString) |
#define PH_DEFINE_EXTERNAL_LOG_GROUP | ( | groupName, | |
category ) PH_DEFINE_INLINE_LOG_GROUP(groupName, category) |
Defines a public logger in a header file. The logger will be usable anywhere that includes the header file containing this call.
#define PH_DEFINE_INLINE_LOG_GROUP | ( | groupName, | |
category ) |
#define PH_DEFINE_INTERNAL_LOG_GROUP | ( | groupName, | |
category ) |
Defines a logger that is private to a .cpp file. Can only appear one time in a translation unit, preferably in a .cpp file.
#define PH_DEFINE_LOG_GROUP | ( | groupName, | |
category ) |
Defines a logger.
#define PH_LOG | ( | groupName, | |
level, | |||
formatString, | |||
... ) PH_LOG_FORMAT_STRING_TO_CORE_LOGGER(groupName, level, formatString, __VA_ARGS__) |
#define PH_LOG_FORMAT_STRING_TO_CORE_LOGGER | ( | groupName, | |
level, | |||
formatString, | |||
... ) |
#define PH_LOG_RAW_STRING_TO_CORE_LOGGER | ( | groupName, | |
level, | |||
rawStringExpr ) |
#define PH_LOG_STRING | ( | groupName, | |
level, | |||
rawString ) PH_LOG_RAW_STRING_TO_CORE_LOGGER(groupName, level, rawString) |