vendredi 26 août 2022

How to forward the micro args to format func?

#define LOG_INFO(str, ...)                                              \
  logger.NewLogStateMent(__FILE__, __LINE__,                            \
                         fver::base::log::Logger::LogLevel::kInfo, str, \
                         ##__VA_ARGS__)
void NewLogStateMent(const char* filename, const int len, LogLevel lev, ...) {
  std::cout << fmt::format("{} {} {} {} {}", filename, lne, lev, ...);
}
// use case
int main () {
  LOG_INFO("hello, world %d", 1);
}

Now i want to this LOG_INFO(str, ...) to a fmt::format();

But the Gcc give me a lot of errors gcc version: 12.2.0

c++ version: c++17

How can i finish it?

Please help me!

Aucun commentaire:

Enregistrer un commentaire