Skip to content

DEBUG_LOG, DEBUG_CRASH & Co need their caller strings to end on "\n" #1021

@xezon

Description

@xezon

For DEBUG_LOG it is required to add "\n" as per

static void doLogOutput(const char *buffer)
{
...
  fprintf(theLogFile, "%s", buffer);	// note, no \n (should be there already)

And for DEBUG_CRASH it is also required to add "\n", because it will also log out.

void DebugCrash(const char *format, ...)
{
...
  format = prepBuffer(format, theCrashBuffer);
  strcat(theCrashBuffer, "ASSERTION FAILURE: ");

  va_list arg;
  va_start(arg, format);
  vsprintf(theCrashBuffer + strlen(theCrashBuffer), format, arg);
  va_end(arg);
...
  whackFunnyCharacters(theCrashBuffer);
  doLogOutput(theCrashBuffer); // <----- xezon: will log here

This is not nice. Makes its use error prone. Some callers will and do forget to add a trailing \n to their strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebugIs mostly debug functionalityInvestigateMinorSeverity: Minor < Major < Critical < BlockerRefactorEdits the code with insignificant behavior changes, is never user facing

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions