| 145 | } |
| 146 | |
| 147 | std::wstring OsirisProxy::MakeLogFilePath(std::wstring const & Type, std::wstring const & Extension) |
| 148 | { |
| 149 | BOOL created = CreateDirectoryW(LogDirectory.c_str(), NULL); |
| 150 | if (created == FALSE) |
| 151 | { |
| 152 | DWORD lastError = GetLastError(); |
| 153 | if (lastError != ERROR_ALREADY_EXISTS) |
| 154 | { |
| 155 | std::wstringstream err; |
| 156 | err << L"Could not create log directory '" << LogDirectory << "': Error " << lastError; |
| 157 | Fail(err.str().c_str()); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | auto now = std::chrono::system_clock::now(); |
| 162 | auto tt = std::chrono::system_clock::to_time_t(now); |
| 163 | std::tm tm; |
| 164 | gmtime_s(&tm, &tt); |
| 165 | |
| 166 | std::wstringstream ss; |
| 167 | ss << LogDirectory << L"\\" |
| 168 | << Type << L" " |
| 169 | << std::setfill(L'0') |
| 170 | << (tm.tm_year + 1900) << L"-" |
| 171 | << std::setw(2) << (tm.tm_mon + 1) << L"-" |
| 172 | << std::setw(2) << tm.tm_mday << L" " |
| 173 | << std::setw(2) << tm.tm_hour << L"-" |
| 174 | << std::setw(2) << tm.tm_min << L"-" |
| 175 | << std::setw(2) << tm.tm_sec << L"." << Extension; |
| 176 | return ss.str(); |
| 177 | } |
| 178 | |
| 179 | void OsirisProxy::HookNodeVMTs() |
| 180 | { |