Changeset 28695 in vbox
- Timestamp:
- Apr 24, 2010 9:35:20 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/log.h
r27615 r28695 324 324 /** Show decimal timestamps with PREFIX_TSC and PREFIX_TS */ 325 325 RTLOGFLAGS_DECIMAL_TS = 0x00000080, 326 /** Log flushing disabled. */ 327 RTLOGFLAGS_NO_FLUSH = 0x00000100, 326 /** Open the file in write through mode. */ 327 RTLOGFLAGS_WRITE_THROUGH = 0x00000100, 328 /** Flush the file to disk when flushing the buffer. */ 329 RTLOGFLAGS_FLUSH = 0x00000200, 328 330 /** New lines should be prefixed with the write and read lock counts. */ 329 331 RTLOGFLAGS_PREFIX_LOCK_COUNTS = 0x00008000, -
trunk/src/VBox/Runtime/common/log/log.cpp
r28271 r28695 159 159 { "dec", sizeof("dec" ) - 1, RTLOGFLAGS_DECIMAL_TS, false }, 160 160 { "hex", sizeof("hex" ) - 1, RTLOGFLAGS_DECIMAL_TS, true }, 161 { "writethru", sizeof("writethru" ) - 1, RTLOGFLAGS_WRITE_THROUGH, true }, 162 { "writethrough", sizeof("writethrough") - 1, RTLOGFLAGS_WRITE_THROUGH, true }, 163 { "flush", sizeof("flush" ) - 1, RTLOGFLAGS_FLUSH, true }, 161 164 { "lockcnts", sizeof("lockcnts" ) - 1, RTLOGFLAGS_PREFIX_LOCK_COUNTS, false }, 162 165 { "cpuid", sizeof("cpuid" ) - 1, RTLOGFLAGS_PREFIX_CPUID, false }, … … 382 385 if (pLogger->fDestFlags & RTLOGDEST_FILE) 383 386 { 384 if (!(pLogger->fFlags & RTLOGFLAGS_APPEND))385 rc = RTFileOpen(&pLogger->File, pLogger->pszFilename,386 RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_WRITE);387 uint32_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE; 388 if (pLogger->fFlags & RTLOGFLAGS_APPEND) 389 fOpen |= RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND; 387 390 else 388 { 389 /** @todo RTFILE_O_APPEND. */ 390 rc = RTFileOpen(&pLogger->File, pLogger->pszFilename, 391 RTFILE_O_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE); 392 if (RT_SUCCESS(rc)) 393 { 394 rc = RTFileSeek(pLogger->File, 0, RTFILE_SEEK_END, NULL); 395 if (RT_FAILURE(rc)) 396 { 397 RTFileClose(pLogger->File); 398 pLogger->File = NIL_RTFILE; 399 } 400 } 401 } 391 fOpen |= RTFILE_O_CREATE_REPLACE; 392 if (pLogger->fFlags & RTLOGFLAGS_WRITE_THROUGH) 393 fOpen |= RTFILE_O_WRITE_THROUGH; 394 rc = RTFileOpen(&pLogger->File, pLogger->pszFilename, fOpen); 402 395 if (RT_FAILURE(rc) && pszErrorMsg) 403 RTStrPrintf(pszErrorMsg, cchErrorMsg, "could not open file '%s' ", pLogger->pszFilename);396 RTStrPrintf(pszErrorMsg, cchErrorMsg, "could not open file '%s' (fOpen=%#x)", pLogger->pszFilename, fOpen); 404 397 } 405 398 #endif /* IN_RING3 */ … … 2208 2201 # ifdef IN_RING3 2209 2202 if (pLogger->fDestFlags & RTLOGDEST_FILE) 2203 { 2210 2204 RTFileWrite(pLogger->File, pLogger->achScratch, pLogger->offScratch, NULL); 2205 if (pLogger->fFlags & RTLOGFLAGS_FLUSH) 2206 RTFileFlush(pLogger->File); 2207 } 2211 2208 # endif 2212 2209
Note:
See TracChangeset
for help on using the changeset viewer.