MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / open

Method open

ProgramLog/lazyfilesink.cpp:58–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57template<typename Mutex>
58void lazy_file_sink<Mutex>::open()
59{
60 if (!std::exchange(m_Tried, true))
61 {
62 std::error_code err;
63 std::filesystem::create_directories(m_File.parent_path(), err);
64 if (!err)
65 {
66 m_Handle.reset(CreateFile(m_File.c_str(), GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr));
67 if (m_Handle)
68 {
69 write(UTF8_BOM);
70 }
71 else
72 {
73 LastErrorHandle(spdlog::level::err, L"Failed to create log file. Logs won't be available during this session.");
74 }
75 }
76 else
77 {
78 StdErrorCodeHandle(err, spdlog::level::err, L"Failed to create log directory. Logs won't be available during this session.");
79 }
80 }
81}
82
83template<typename Mutex>
84template<typename T>

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected