Merge pull request #3433 from akallabeth/wlog_callbac_init_fix

Wlog callback init fix
This commit is contained in:
David Fort 2016-07-05 15:15:19 +02:00 committed by GitHub
commit 4a67ba8d7f
2 changed files with 21 additions and 1 deletions

View File

@ -111,6 +111,7 @@ WINPR_API BOOL WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args
do { \
if (_log && _log_level >= WLog_GetLogLevel(_log)) { \
wLogMessage _log_message; \
memset(&_log_message, 0, sizeof(_log_message)); \
_log_message.Type = WLOG_MESSAGE_TEXT; \
_log_message.Level = _log_level; \
_log_message.FormatString = _fmt; \
@ -125,6 +126,7 @@ WINPR_API BOOL WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args
do { \
if (_log && _log_level >= WLog_GetLogLevel(_log)) { \
wLogMessage _log_message; \
memset(&_log_message, 0, sizeof(_log_message)); \
_log_message.Type = WLOG_MESSAGE_TEXT; \
_log_message.Level = _log_level; \
_log_message.FormatString = _fmt; \
@ -139,6 +141,7 @@ WINPR_API BOOL WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args
do { \
if (_log && _log_level >= WLog_GetLogLevel(_log)) { \
wLogMessage _log_message; \
memset(&_log_message, 0, sizeof(_log_message)); \
_log_message.Type = WLOG_MESSAGE_DATA; \
_log_message.Level = _log_level; \
_log_message.FormatString = NULL; \
@ -153,6 +156,7 @@ WINPR_API BOOL WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args
do { \
if (_log && _log_level >= WLog_GetLogLevel(_log)) { \
wLogMessage _log_message; \
memset(&_log_message, 0, sizeof(_log_message)); \
_log_message.Type = WLOG_MESSAGE_IMAGE; \
_log_message.Level = _log_level; \
_log_message.FormatString = NULL; \
@ -167,6 +171,7 @@ WINPR_API BOOL WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args
do { \
if (_log && _log_level >= WLog_GetLogLevel(_log)) { \
wLogMessage _log_message; \
memset(&_log_message, 0, sizeof(_log_message)); \
_log_message.Type = WLOG_MESSAGE_PACKET; \
_log_message.Level = _log_level; \
_log_message.FormatString = NULL; \

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);