MCPcopy Create free account
hub / github.com/ZDoom/Raze / WriteLineToLog

Function WriteLineToLog

source/common/console/c_console.cpp:379–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377//==========================================================================
378
379void WriteLineToLog(FILE *LogFile, const char *outline)
380{
381 // Strip out any color escape sequences before writing to the log file
382 TArray<char> copy(strlen(outline) + 1);
383 const char * srcp = outline;
384 char * dstp = copy.Data();
385
386 while (*srcp != 0)
387 {
388
389 if (*srcp != TEXTCOLOR_ESCAPE)
390 {
391 *dstp++ = *srcp++;
392 }
393 else if (srcp[1] == '[')
394 {
395 srcp += 2;
396 while (*srcp != ']' && *srcp != 0) srcp++;
397 if (*srcp == ']') srcp++;
398 }
399 else
400 {
401 if (srcp[1] != 0) srcp += 2;
402 else break;
403 }
404 }
405 *dstp = 0;
406
407 fputs(copy.Data(), LogFile);
408 fflush(LogFile);
409}
410
411extern bool gameisdead;
412

Callers 1

PrintStringFunction · 0.85

Calls 1

DataMethod · 0.45

Tested by

no test coverage detected