0

I have tons of code which uses Google Logger style of log printing: LOG(ERROR) << "AAAA" <<< 123;

And currently I need to replace Google logger by spdlog logger, which supports python like format: logger->error("{} {}", "param1", 123);

Of course I don't want to change each log line in the code. What I am trying to do, is to rewrite LOG(severity) macro definition. The original macro implementation is: #define LOG(severity) COMPACT_GOOGLE_LOG_ ## severity.stream()

Can you please recommend me how should I implement the macro? My idea was that the original arguments that were passed to LOG(ERROR) (i.e. << "AAAA" <<< 123) should be printed to a string buffer, and the string buffer will be printed to the destination spdlog logger instance like this: logger->error("{}", str_buffer.c_str());

What is the best idea for doing this? Thanks so much!!!

user3518295
  • 180
  • 3
  • 14

1 Answers1

0

Here the correct answer was posted https://github.com/gabime/spdlog/issues/1804

user3518295
  • 180
  • 3
  • 14