Permalink
Browse files

Adapt logging API for new worker API

  • Loading branch information...
pp3345 committed Jun 21, 2013
1 parent aeb8625 commit 3c3a177a4d223fc0d311df689d3672ff30689703
Showing with 4 additions and 3 deletions.
  1. +4 −3 PancakeLogger.c
View
@@ -1,6 +1,7 @@
#include "PancakeLogger.h"
#include "PancakeDateTime.h"
#include "PancakeWorkers.h"
/*
* Pancake Logging API
@@ -18,13 +19,13 @@ PANCAKE_API void PancakeLogger(UByte type, UByte flags, String *text) {
date = PancakeFormatDateTime(time(NULL));
/* 5 = []__\n */
output.length = PancakeCurrentWorker.name.length + date.length + text->length + (type == PANCAKE_LOGGER_ERROR ? sizeof("Error:") + 5 : 5);
output.length = PancakeCurrentWorker->name.length + date.length + text->length + (type == PANCAKE_LOGGER_ERROR ? sizeof("Error:") + 5 : 5);
output.value = PancakeAllocate(output.length);
/* Build output string */
offset = type == PANCAKE_LOGGER_ERROR
? sprintf(output.value, "%s [%s] Error: ", date.value, PancakeCurrentWorker.name.value)
: sprintf(output.value, "%s [%s] ", date.value, PancakeCurrentWorker.name.value);
? sprintf(output.value, "%s [%s] Error: ", date.value, PancakeCurrentWorker->name.value)
: sprintf(output.value, "%s [%s] ", date.value, PancakeCurrentWorker->name.value);
/* text might contain NULL bytes */
memcpy(output.value + offset, text->value, text->length);

0 comments on commit 3c3a177

Please sign in to comment.