| 311 | } |
| 312 | |
| 313 | void |
| 314 | jassert_internal::JAssert::writeToLog(const char *str) |
| 315 | { |
| 316 | // Lazily open log file. |
| 317 | if (theLogFileFd == -1) { |
| 318 | if (write(jalib::logFd(), str, 0) != -1) { |
| 319 | theLogFileFd = jalib::logFd(); |
| 320 | } else if (logFilePath[0] != '\0') { |
| 321 | open_log_file(); |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | if (theLogFileFd != -1) { |
| 326 | int rv = jwrite(theLogFileFd, str); |
| 327 | |
| 328 | if (rv < 0 && theLogFileFd == EBADF) { |
| 329 | if (errConsoleFd != -1) { |
| 330 | jwrite(errConsoleFd, "JASSERT: failed to write to log file.\n"); |
| 331 | } |
| 332 | theLogFileFd = -1; |
| 333 | } |
| 334 | } |
| 335 | } |