Skip to content

Commit

Permalink
fix: 🐛 fix the compile-time checking failure in c++20
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy-Liuxf committed Aug 22, 2024
1 parent 0e9915f commit 5d0f394
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
42 changes: 18 additions & 24 deletions include/simple_logger/simple_logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ class Logger {
(this->Trace() << ... << std::forward<Vals>(vals));
}

template <typename Format, typename... Args>
void Tracef(Format&& fmt, Args&&... args) {
this->Trace() << fmt::format(std::forward<Format>(fmt),
std::forward<Args>(args)...);
template <typename... Args>
void Tracef(fmt::format_string<Args...> fmt, Args&&... args) {
this->Trace() << fmt::format(fmt, std::forward<Args>(args)...);
}

auto Debug() {
Expand All @@ -179,10 +178,9 @@ class Logger {
(this->Debug() << ... << std::forward<Vals>(vals));
}

template <typename Format, typename... Args>
void Debugf(Format&& fmt, Args&&... args) {
this->Debug() << fmt::format(std::forward<Format>(fmt),
std::forward<Args>(args)...);
template <typename... Args>
void Debugf(fmt::format_string<Args...> fmt, Args&&... args) {
this->Debug() << fmt::format(fmt, std::forward<Args>(args)...);
}

auto Info() {
Expand All @@ -198,10 +196,9 @@ class Logger {
(this->Info() << ... << std::forward<Vals>(vals));
}

template <typename Format, typename... Args>
void Infof(Format&& fmt, Args&&... args) {
this->Info() << fmt::format(std::forward<Format>(fmt),
std::forward<Args>(args)...);
template <typename... Args>
void Infof(fmt::format_string<Args...> fmt, Args&&... args) {
this->Info() << fmt::format(fmt, std::forward<Args>(args)...);
}

auto Warn() {
Expand All @@ -217,10 +214,9 @@ class Logger {
(this->Warn() << ... << std::forward<Vals>(vals));
}

template <typename Format, typename... Args>
void Warnf(Format&& fmt, Args&&... args) {
this->Warn() << fmt::format(std::forward<Format>(fmt),
std::forward<Args>(args)...);
template <typename... Args>
void Warnf(fmt::format_string<Args...> fmt, Args&&... args) {
this->Warn() << fmt::format(fmt, std::forward<Args>(args)...);
}

auto Error() {
Expand All @@ -236,10 +232,9 @@ class Logger {
(this->Error() << ... << std::forward<Vals>(vals));
}

template <typename Format, typename... Args>
void Errorf(Format&& fmt, Args&&... args) {
this->Error() << fmt::format(std::forward<Format>(fmt),
std::forward<Args>(args)...);
template <typename... Args>
void Errorf(fmt::format_string<Args...> fmt, Args&&... args) {
this->Error() << fmt::format(fmt, std::forward<Args>(args)...);
}

auto Fatal() {
Expand All @@ -255,10 +250,9 @@ class Logger {
(this->Fatal() << ... << std::forward<Vals>(vals));
}

template <typename Format, typename... Args>
void Fatalf(Format&& fmt, Args&&... args) {
this->Fatal() << fmt::format(std::forward<Format>(fmt),
std::forward<Args>(args)...);
template <typename... Args>
void Fatalf(fmt::format_string<Args...> fmt, Args&&... args) {
this->Fatal() << fmt::format(fmt, std::forward<Args>(args)...);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion third_party/fmt
Submodule fmt updated 197 files

0 comments on commit 5d0f394

Please sign in to comment.