0

I am using spdlog library for C++ logging. I have a logger with both stdout and rotating_file_sink_mt sincs:

    auto std_out_sinc = std::make_shared<spdlog::sinks::stdout_sink_mt>();
    auto file_sinc = std::make_shared<spdlog::sinks::rotating_file_sink_mt>("1.log");
    sinks.push_back(std_out_sinc);
    sinks.push_back(file_sync);
    auto combined_logger = std::make_shared<spdlog::logger>("root", begin(sinks), end(sinks));

I would like to have different log formats for different sincs. For example, a very simple format (default) for the stdout and a json format for the file-based sinc ( to be parsed by a log indexing service). Is this possible in spdlog?

motam79
  • 3,542
  • 5
  • 34
  • 60

1 Answers1

0

spdlog branch v1.x supports this (not officially released yet but you can give it a try).

GabiMe
  • 18,105
  • 28
  • 76
  • 113