MyGit

v1.10.0

gabime/spdlog

版本发布时间: 2022-04-04 22:27:45

gabime/spdlog最新发布版本:v1.14.1(2024-04-30 20:34:26)

  void file_events_example()
  {
    // pass the spdlog::file_event_handlers to file sinks for open/close log file notifications
    spdlog::file_event_handlers handlers;
    handlers.before_open = [](spdlog::filename_t filename) { spdlog::info("Before opening {}", filename); };
    handlers.after_open = [](spdlog::filename_t filename, std::FILE *fstream) { fputs("After opening\n", fstream); };
    handlers.before_close = [](spdlog::filename_t filename, std::FILE *fstream) { fputs("Before closing\n", fstream); };
    handlers.after_close = [](spdlog::filename_t filename) { spdlog::info("After closing {}", filename); };
    auto my_logger = spdlog::basic_logger_st("some_logger", "logs/events-sample.txt", true, handlers);        
  }

Special thanks to @tt4g for his support in answering community questions and issues.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2022-04-04发行的版本