You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

loggersetup.cpp 757B

1234567891011121314151617181920212223
  1. #include "loggersetup.h"
  2. namespace vtk {
  3. LoggerSetup::LoggerSetup() {
  4. mLogFolder = "logs";
  5. }
  6. void LoggerSetup::setLogFolder(const std::string& path) {
  7. mLogFolder = path;
  8. }
  9. void LoggerSetup::setup() {
  10. std::vector<spdlog::sink_ptr> logSinks;
  11. logSinks.push_back(std::make_shared<spdlog::sinks::rotating_file_sink_mt>("logs/log", 1048576 * 5, 3));
  12. logSinks.push_back(std::make_shared<spdlog::sinks::stdout_sink_st>());
  13. auto generalLogger = std::make_shared<spdlog::logger>("general", begin(logSinks), end(logSinks));
  14. auto fileLogger = std::make_shared<spdlog::logger>("file", begin(logSinks), end(logSinks));
  15. spdlog::register_logger(generalLogger);
  16. spdlog::register_logger(fileLogger);
  17. spdlog::set_level(spdlog::level::debug);
  18. }
  19. }