Skip to content

Commit

Permalink
fixed a few very minor bugs in the logging logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeldan committed Mar 27, 2021
1 parent ca0debf commit 4f05095
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,13 @@ vasqVLogStatement(const vasqLogger *logger, vasqLogLevel_t level, const char *fi
for (idx = strlen(file_name); idx > 0; idx--) {
if (file_name[idx] == '/') {
idx++;
break;
goto print_file_name;
}
}
if (file_name[0] == '/') { // idx equals 0 here.
idx = 1;
}
print_file_name:
vasqIncSnprintf(&dst, &remaining, "%s", file_name + idx);
break;

Expand All @@ -233,8 +237,9 @@ vasqVLogStatement(const vasqLogger *logger, vasqLogLevel_t level, const char *fi

case 'x':
if (logger->processor) {
logger->processor(logger->user_data, position++, level, &dst, &remaining);
logger->processor(logger->user_data, position, level, &dst, &remaining);
}
position++;
break;

case '%': vasqIncSnprintf(&dst, &remaining, "%%"); break;
Expand Down

0 comments on commit 4f05095

Please sign in to comment.