Made run seed more file name friendly.

This commit is contained in:
Markus Kauppila 2011-07-28 21:35:47 +03:00
parent 9e514b68d3
commit ed4e1582bf
4 changed files with 53 additions and 19 deletions

View file

@ -27,12 +27,17 @@ static FILE *logFile;
int
Output(const int currentIndentLevel, const char *message, ...)
{
if(logFile == NULL) {
fprintf(stderr, "logfile is NULL\n");
exit(3);
}
int indent = 0;
for( ; indent < currentIndentLevel; ++indent) {
fprintf(logFile, " "); // \todo make configurable?
}
char buffer[1024];
char buffer[1024];
memset(buffer, 0, 1024);
va_list list;
@ -41,17 +46,22 @@ Output(const int currentIndentLevel, const char *message, ...)
SDL_vsnprintf(buffer, 1024, message, list);
va_end(list);
fprintf(logFile, "%s\n", buffer);
fflush(logFile);
}
void
PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
time_t eventTime, LoggerData *data)
{
if(data == NULL) {
fprintf(stderr, "Logger data is NULL\n");
exit(3);
}
// Set up the logging destination
if(data->stdoutEnabled) {
if(data->stdoutEnabled == 1) {
logFile = stdout;
} else {
logFile = fopen(data->filename, "w");
@ -61,6 +71,7 @@ PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
}
}
level = data->level;
//printf("Debug: %d == %d\n", level, data->level);
@ -87,6 +98,8 @@ PlainRunEnded(int testCount, int suiteCount, int testPassCount, int testFailCoun
Output(indentLevel, "%d tests passed", testPassCount);
Output(indentLevel, "%d tests failed", testFailCount);
Output(indentLevel, "%d tests skipped", testSkippedCount);
fclose(logFile);
}
void