#ifndef LOG_H #define LOG_H #include "spdlog/spdlog.h" #include #include #define ISINIT \ if (!isInit) { \ qDebug() << "Log not initialized!"; \ return; \ } class Log { public: Log(); static void init(); template static void info(const T& msg) { ISINIT SPDLOG_LOGGER_INFO(logger, msg); } template static void info(Args... args) { ISINIT SPDLOG_LOGGER_INFO(logger, args...); } template static void warn(const T& msg) { ISINIT SPDLOG_LOGGER_WARN(logger, msg); } template static void warn(Args... args) { ISINIT SPDLOG_LOGGER_WARN(logger, args...); } template static void error(const T& msg) { ISINIT SPDLOG_LOGGER_ERROR(logger, msg); } template static void error(Args... args) { ISINIT SPDLOG_LOGGER_ERROR(logger, args...); } template static void critical(const T& msg) { ISINIT SPDLOG_LOGGER_CRITICAL(logger, msg); } template static void critical(Args... args) { ISINIT SPDLOG_LOGGER_CRITICAL(logger, args...); } private: static std::shared_ptr logger; static bool isInit; }; #endif // LOG_H