Beispiel #1
0
//////////////////////////////////////////////////////////////////////////////
// 파일에다 로그하기
//////////////////////////////////////////////////////////////////////////////
void filelog(const char* szFilename, const char* fmt, ...) throw() {
    __BEGIN_TRY

    va_list valist;

    va_start(valist, fmt);

    char buffer[30000];
    char Filename[1024];

    int nchars = vsnprintf(buffer, 30000, fmt, valist);

    sprintf(Filename, "../log/%s", szFilename);
    Filename[1023] = '\0';

    if (nchars == -1 || nchars > 30000) {
        throw("filelog() : more buffer size needed for log");
	}

    va_end(valist);

	VSDateTime current = VSDateTime::currentDateTime();

    ofstream file(Filename, ios::out | ios::app);
    file << current.toString() << " : " << buffer << endl;
    file.close();

    __END_CATCH
}
Beispiel #2
0
void ZoneGroupManager::outputLoadValue()
	throw(Error)
{
	//------------------------------------------------------------------
	// ZoneGroup load
	//------------------------------------------------------------------
	ofstream file("loadBalance.txt", ios::app);

	VSDateTime current = VSDateTime::currentDateTime();
	file << current.toString() << endl;

	map< ZoneGroupID_t , ZoneGroup* >::const_iterator itr;

	for (itr = m_ZoneGroups.begin() ; itr != m_ZoneGroups.end() ; itr ++) 
	{
		ZoneGroup* pZoneGroup = itr->second;
		file << "[" << (int)pZoneGroup->getZoneGroupID() << "] ";

		const map< ZoneID_t, Zone* >& zones = pZoneGroup->getZones();
		map< ZoneID_t, Zone* >::const_iterator iZone;

		// 각 Zone의 loadValue를 구한다.
		int totalLoad = 0;
		for (iZone=zones.begin(); iZone!=zones.end(); iZone++)
		{
			Zone* pZone = iZone->second;

			int load = pZone->getLoadValue();
			int playerLoad = pZone->getPCCount();

			file << (int)pZone->getZoneID() << "(" << load << ", " << playerLoad << ") ";

			totalLoad += load;
		}

		file << " = " << totalLoad << endl;

	}

	file << endl;
	file.close();
}