Do not need to acquire lock for configuration becase startLog is only called from the constructor. If this changes lock will be needed.
| 147 | //Do not need to acquire lock for configuration becase startLog is only called from the constructor. |
| 148 | //If this changes lock will be needed. |
| 149 | void GSDKInternal::startLog() |
| 150 | { |
| 151 | if (m_logFile.is_open()) |
| 152 | { |
| 153 | return; |
| 154 | } |
| 155 | std::string logFile = "GSDK_output_" + std::to_string((unsigned long long)time(nullptr)) + ".txt"; |
| 156 | std::string logFolder = m_configSettings[GSDK::LOG_FOLDER_KEY]; |
| 157 | if (!logFolder.empty() && !cGSDKUtils::createDirectoryIfNotExists(logFolder)) // If we couldn't successfully create the path, just use the current directory |
| 158 | { |
| 159 | logFolder = ""; |
| 160 | } |
| 161 | #if _WIN32 |
| 162 | if (!logFolder.empty() && logFolder.back() != '/' && logFolder.back() != '\\') |
| 163 | { |
| 164 | logFolder.append("\\"); |
| 165 | } |
| 166 | #else |
| 167 | if (!logFolder.empty() && logFolder.back() != '/') |
| 168 | { |
| 169 | logFolder.append("/"); |
| 170 | } |
| 171 | #endif |
| 172 | std::string logPath = logFolder + logFile; |
| 173 | m_logFile.open(logPath.c_str(), std::ofstream::out); |
| 174 | } |
| 175 | |
| 176 | void GSDKInternal::heartbeatThreadFunc(std::string infoUrl) |
| 177 | { |