fix format string when building with newer versions of libstdc++
All checks were successful
Build (Arch Linux) / build (push) Successful in 3m30s
All checks were successful
Build (Arch Linux) / build (push) Successful in 3m30s
This commit is contained in:
parent
54ca5c23a0
commit
396e22b348
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
#include "logging/logger.hpp"
|
#include "logging/logger.hpp"
|
||||||
|
|
||||||
|
#include <format>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace kuiper
|
namespace kuiper
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -20,33 +23,33 @@ class engine_logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void trace(const char* fmt, Args... args) {
|
inline void trace(std::format_string<Args...> fmt, Args... args) {
|
||||||
m_log.trace(fmt, args...);
|
m_log.trace(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void debug(const char* fmt, Args... args) {
|
inline void debug(std::format_string<Args...> fmt, Args... args) {
|
||||||
m_log.debug(fmt, args...);
|
m_log.debug(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void info(const char* fmt, Args... args) {
|
inline void info(std::format_string<Args...> fmt, Args... args) {
|
||||||
m_log.info(fmt, args...);
|
m_log.info(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void warn(const char* fmt, Args... args) {
|
inline void warn(std::format_string<Args...> fmt, Args... args) {
|
||||||
m_log.warn(fmt, args...);
|
m_log.warn(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void error(const char* fmt, Args... args) {
|
inline void error(std::format_string<Args...> fmt, Args... args) {
|
||||||
m_log.error(fmt, args...);
|
m_log.error(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void critical(const char* fmt, Args... args) {
|
inline void critical(std::format_string<Args...> fmt, Args... args) {
|
||||||
m_log.critical(fmt, args...);
|
m_log.critical(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <format>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string_view> // TODO: Use std::format_string when available
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||||
@ -31,32 +31,32 @@ class logger {
|
|||||||
~logger() = default;
|
~logger() = default;
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void trace(std::string_view fmt, Args&&... args) {
|
inline void trace(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
m_log->trace(fmt, std::forward<Args>(args)...);
|
m_log->trace(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void debug(std::string_view fmt, Args&&... args) {
|
inline void debug(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
m_log->debug(fmt, std::forward<Args>(args)...);
|
m_log->debug(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void info(std::string_view fmt, Args&&... args) {
|
inline void info(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
m_log->info(fmt, std::forward<Args>(args)...);
|
m_log->info(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void warn(std::string_view fmt, Args&&... args) {
|
inline void warn(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
m_log->warn(fmt, std::forward<Args>(args)...);
|
m_log->warn(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void error(std::string_view fmt, Args&&... args) {
|
inline void error(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
m_log->error(fmt, std::forward<Args>(args)...);
|
m_log->error(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void critical(std::string_view fmt, Args&&... args) {
|
inline void critical(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
m_log->critical(fmt, std::forward<Args>(args)...);
|
m_log->critical(fmt, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user