| 163 | } |
| 164 | |
| 165 | void openRotatingLog(const char* fileName, bool append) |
| 166 | { |
| 167 | if (!fileName) { return; } |
| 168 | |
| 169 | char logPath[TFE_MAX_PATH]; |
| 170 | TFE_Paths::appendPath(PATH_USER_DOCUMENTS, fileName, logPath); |
| 171 | |
| 172 | // Handle rotations |
| 173 | for (int i = maxLogRotations; i > 0; i--) |
| 174 | { |
| 175 | char oldLogPath[TFE_MAX_PATH]; |
| 176 | char newLogPath[TFE_MAX_PATH]; |
| 177 | if (i == 1) |
| 178 | { |
| 179 | sprintf(oldLogPath, "%s", logPath); |
| 180 | } |
| 181 | else |
| 182 | { |
| 183 | sprintf(oldLogPath, "%s.%d", logPath, i - 1); |
| 184 | } |
| 185 | |
| 186 | if (FileUtil::exists(oldLogPath)) |
| 187 | { |
| 188 | sprintf(newLogPath, "%s.%d", logPath, i); |
| 189 | FileUtil::copyFile(oldLogPath, newLogPath); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | // Open file as normal |
| 194 | logOpen(fileName, append); |
| 195 | } |
| 196 | } |
| 197 |
no test coverage detected