Esempio n. 1
0
int WLog_WritePacket(wLog* log, wLogMessage* message)
{
	int status = -1;
	wLogAppender* appender;
	appender = WLog_GetLogAppender(log);

	if (!appender)
		return -1;

	if (!appender->State)
		WLog_OpenAppender(log);

	if (!appender->WritePacketMessage)
		return -1;

	EnterCriticalSection(&appender->lock);

	if (appender->recursive)
		log_recursion(message->FileName, message->FunctionName, message->LineNumber);
	else
	{
		appender->recursive = TRUE;
		status = appender->WritePacketMessage(log, appender, message);
		appender->recursive = FALSE;
	}

	LeaveCriticalSection(&appender->lock);
	return status;
}
Esempio n. 2
0
BOOL WLog_WriteImage(wLog* log, wLogMessage* message)
{
	BOOL status;
	wLogAppender* appender;
	appender = WLog_GetLogAppender(log);

	if (!appender)
		return FALSE;

	if (!appender->active)
		if (!WLog_OpenAppender(log))
			return FALSE;

	if (!appender->WriteImageMessage)
		return FALSE;

	EnterCriticalSection(&appender->lock);

	if (appender->recursive)
		status = log_recursion(message->FileName, message->FunctionName, message->LineNumber);
	else
	{
		appender->recursive = TRUE;
		status = appender->WriteImageMessage(log, appender, message);
		appender->recursive = FALSE;
	}

	LeaveCriticalSection(&appender->lock);
	return status;
}