Пример #1
0
void LoggableFrontend::Update()
{
	if (!PrepareData())
	{
		FreeData();
		return;
	}

	BeforePrint();

	MessageList* pMessages = LockMessages();
	if (!pMessages->empty())
	{
		Message* pFirstMessage = pMessages->front();
		int iStart = m_iNeededLogFirstID - pFirstMessage->GetID() + 1;
		if (iStart < 0)
		{
			PrintSkip();
			iStart = 0;
		}
		for (unsigned int i = (unsigned int)iStart; i < pMessages->size(); i++)
		{
			PrintMessage((*pMessages)[i]);
			m_iNeededLogFirstID = (*pMessages)[i]->GetID();
		}
	}
	UnlockMessages();

	PrintStatus();

	FreeData();

	fflush(stdout);
}
Пример #2
0
void NServFrontend::Update()
{
	BeforePrint();

	{
		GuardedMessageList messages = g_Log->GuardMessages();
		if (!messages->empty())
		{
			Message& firstMessage = messages->front();
			int start = m_neededLogFirstId - firstMessage.GetId() + 1;
			if (start < 0)
			{
				PrintSkip();
				start = 0;
			}
			for (uint32 i = (uint32)start; i < messages->size(); i++)
			{
				PrintMessage(messages->at(i));
				m_neededLogFirstId = messages->at(i).GetId();
			}
		}
	}

	fflush(stdout);
}