Initialise WLog PrefixString for each message type.

This commit is contained in:
Armin Novak 2016-07-05 13:00:54 +02:00
parent a132545545
commit d96fbd1bce

View File

@ -49,6 +49,7 @@ static BOOL WLog_CallbackAppender_WriteMessage(wLog* log, wLogAppender* appender
if (!appender)
return FALSE;
message->PrefixString = prefix;
WLog_Layout_GetMessagePrefix(log, appender->Layout, message);
@ -62,11 +63,15 @@ static BOOL WLog_CallbackAppender_WriteMessage(wLog* log, wLogAppender* appender
static BOOL WLog_CallbackAppender_WriteDataMessage(wLog* log, wLogAppender* appender, wLogMessage* message)
{
char prefix[WLOG_MAX_PREFIX_SIZE];
wLogCallbackAppender* callbackAppender;
if (!appender)
return FALSE;
message->PrefixString = prefix;
WLog_Layout_GetMessagePrefix(log, appender->Layout, message);
callbackAppender = (wLogCallbackAppender *)appender;
if (callbackAppender->callbacks && callbackAppender->callbacks->data)
return callbackAppender->callbacks->data(message);
@ -76,10 +81,15 @@ static BOOL WLog_CallbackAppender_WriteDataMessage(wLog* log, wLogAppender* appe
static BOOL WLog_CallbackAppender_WriteImageMessage(wLog* log, wLogAppender* appender, wLogMessage* message)
{
char prefix[WLOG_MAX_PREFIX_SIZE];
wLogCallbackAppender* callbackAppender;
if (!appender)
return FALSE;
message->PrefixString = prefix;
WLog_Layout_GetMessagePrefix(log, appender->Layout, message);
callbackAppender = (wLogCallbackAppender *)appender;
if (callbackAppender->callbacks && callbackAppender->callbacks->image)
return callbackAppender->callbacks->image(message);
@ -89,10 +99,15 @@ static BOOL WLog_CallbackAppender_WriteImageMessage(wLog* log, wLogAppender* app
static BOOL WLog_CallbackAppender_WritePacketMessage(wLog* log, wLogAppender* appender, wLogMessage* message)
{
char prefix[WLOG_MAX_PREFIX_SIZE];
wLogCallbackAppender* callbackAppender;
if (!appender)
return FALSE;
message->PrefixString = prefix;
WLog_Layout_GetMessagePrefix(log, appender->Layout, message);
callbackAppender = (wLogCallbackAppender *)appender;
if (callbackAppender->callbacks && callbackAppender->callbacks->package)
return callbackAppender->callbacks->package(message);