| 40 | } |
| 41 | |
| 42 | void wd::common::Logging::AddLogger(std::string codespace) |
| 43 | { |
| 44 | if (!isInitialized) |
| 45 | { |
| 46 | std::cout << "[WinDurango::Common::Logging.Initialize] - Critical: Logging isn't Initiailized\n"; |
| 47 | return; |
| 48 | } |
| 49 | try |
| 50 | { |
| 51 | auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>(); |
| 52 | auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(pFile->fullfilepath().string(), true); |
| 53 | |
| 54 | console_sink->set_pattern("[%n] [%H:%M:%S] [thread %t] - %^%l%$: %v"); |
| 55 | file_sink->set_pattern("[%n] [%H:%M:%S] [thread %t] - %^%l%$: %v"); |
| 56 | |
| 57 | std::shared_ptr<spdlog::logger> logg = |
| 58 | std::make_shared<spdlog::logger>(codespace, spdlog::sinks_init_list{console_sink, file_sink}); |
| 59 | |
| 60 | log[codespace] = logg; |
| 61 | log[codespace]->set_pattern("[%n] [%H:%M:%S] [thread %t] - %^%l%$: %v"); |
| 62 | log[codespace]->flush_on(spdlog::level::info); |
| 63 | } |
| 64 | catch (const spdlog::spdlog_ex &e) |
| 65 | { |
| 66 | std::cout << "[WinDurango::Common::Logging.spdlog] - Critical: " << e.what() << "\n"; |
| 67 | } |
| 68 | catch (const std::exception &e) |
| 69 | { |
| 70 | std::cout << "[WinDurango::Common::Logging.exception] - Critical: " << e.what() << "\n"; |
| 71 | } |
| 72 | catch (...) |
| 73 | { |
| 74 | std::cout << "[WinDurango::Common::Logging.(...))] - Critical: Unknown Error\n"; |
| 75 | } |
| 76 | } |
nothing calls this directly
no test coverage detected