Skip to content

File log.h

FileList > common > log.h

Go to the source code of this file

  • #include <spdlog/spdlog.h>
  • #include <uipc/common/string.h>
  • #include <uipc/common/config.h>

Macros

Type Name
define UIPC_ASSERT (condition, ...)
define UIPC_ERROR_WITH_LOCATION (...) UIPC_LOG_WITH_LOCATION(spdlog::level::err, __VA_ARGS__)
define UIPC_INFO_WITH_LOCATION (...) UIPC_LOG_WITH_LOCATION(spdlog::level::info, __VA_ARGS__)
define UIPC_LOG_WITH_LOCATION (level, ...)
define UIPC_WARN_WITH_LOCATION (...) UIPC_LOG_WITH_LOCATION(spdlog::level::warn, __VA_ARGS__)

Macro Definition Documentation

define UIPC_ASSERT

#define UIPC_ASSERT (
    condition,
    ...
) if constexpr(::uipc::RUNTIME_CHECK)                                                   \
    {                                                                                     \
        if(!(condition))                                                                  \
        {                                                                                 \
            ::uipc::string msg = ::fmt::format(__VA_ARGS__);                              \
            ::uipc::string assert_meg =                                                   \
                ::fmt::format("Assertion " #condition " failed. {}", msg);                \
            spdlog::log(spdlog::level::err, "{} {}({})", assert_meg, __FILE__, __LINE__); \
            ::std::abort();                                                               \
        }                                                                                 \
    }

define UIPC_ERROR_WITH_LOCATION

#define UIPC_ERROR_WITH_LOCATION (
    ...
) UIPC_LOG_WITH_LOCATION(spdlog::level::err, __VA_ARGS__)

define UIPC_INFO_WITH_LOCATION

#define UIPC_INFO_WITH_LOCATION (
    ...
) UIPC_LOG_WITH_LOCATION(spdlog::level::info, __VA_ARGS__)

define UIPC_LOG_WITH_LOCATION

#define UIPC_LOG_WITH_LOCATION (
    level,
    ...
) {                                                                          \
        ::uipc::string msg = ::fmt::format(__VA_ARGS__);                       \
        spdlog::log((level), "{} {}({})", msg, __FILE__, __LINE__);            \
    }

define UIPC_WARN_WITH_LOCATION

#define UIPC_WARN_WITH_LOCATION (
    ...
) UIPC_LOG_WITH_LOCATION(spdlog::level::warn, __VA_ARGS__)


The documentation for this class was generated from the following file include/uipc/common/log.h