Example #1
0
//-------------------------------------------------------------------------------------
bool LogWatcher::updateSetting(MemoryStream * s)
{
	reset();
	
	(*s) >> filterOptions_.uid;
	(*s) >> filterOptions_.logtypes;
	(*s) >> filterOptions_.globalOrder;
	(*s) >> filterOptions_.groupOrder;
	(*s) >> filterOptions_.date;
	(*s) >> filterOptions_.keyStr;

	int8 count = 0;
	(*s) >> count;
	
	for(int8 i=0; i<count; ++i)
	{
		COMPONENT_TYPE type;
		(*s) >> type;

		if(VALID_COMPONENT(type))
			filterOptions_.componentBitmap[type] = 1;
	}

	return true;
}
Example #2
0
//-------------------------------------------------------------------------------------
void LogWatcher::onMessage(LOG_ITEM* pLogItem)
{
	if(!VALID_COMPONENT(pLogItem->componentType) || filterOptions_.componentBitmap[pLogItem->componentType] == 0)
		return;

	if(filterOptions_.uid != pLogItem->uid)
		return;

	if((filterOptions_.logtypes & pLogItem->logtype) <= 0)
		return;

	if(filterOptions_.globalOrder > 0 && filterOptions_.globalOrder != pLogItem->componentGlobalOrder)
		return;

	if(filterOptions_.groupOrder > 0 && filterOptions_.groupOrder != pLogItem->componentGroupOrder)
		return;

	Network::Channel* pChannel = Logger::getSingleton().networkInterface().findChannel(addr_);

	if(pChannel == NULL)
		return;

	if(!validDate_(pLogItem->logstream.str()) || !containKeyworlds_(pLogItem->logstream.str()))
		return;

	Network::Bundle* pBundle = Network::Bundle::createPoolObject();
	ConsoleInterface::ConsoleLogMessageHandler msgHandler;
	(*pBundle).newMessage(msgHandler);
	(*pBundle) << pLogItem->logstream.str().c_str();
	pChannel->send(pBundle);
}
Example #3
0
//-------------------------------------------------------------------------------------
bool LogWatcher::loadFromStream(MemoryStream * s)
{
	reset();
	
	(*s) >> logtypes_;
	(*s) >> appOrder_;
	int8 count = 0;
	(*s) >> count;
	
	for(int8 i=0; i<count; i++)
	{
		COMPONENT_TYPE type;
		(*s) >> type;
		if(VALID_COMPONENT(type))
			componentBitmap_[type] = 1;
	}
	
	return true;
}
Example #4
0
//-------------------------------------------------------------------------------------
void LogWatcher::onMessage(uint32 logtype, COMPONENT_TYPE componentType, COMPONENT_ID componentID, COMPONENT_ORDER componentOrder, 
	int64 tm, GAME_TIME kbetime, const std::string& str, const std::stringstream& sstr)
{
	if(!VALID_COMPONENT(componentType) || componentBitmap_[componentType] == 0)
		return;

	if((logtypes_ & logtype) <= 0)
		return;

	if(appOrder_ > 0 && appOrder_ != componentOrder)
		return;


	Mercury::Channel* pChannel = Messagelog::getSingleton().getNetworkInterface().findChannel(addr_);

	if(pChannel == NULL)
		return;

	Mercury::Bundle bundle;
	ConsoleInterface::ConsoleLogMessageHandler msgHandler;
	bundle.newMessage(msgHandler);
	bundle << sstr.str().c_str();
	bundle.send(Messagelog::getSingleton().getNetworkInterface(), pChannel);
}