本文整理汇总了C++中LogManager::Check方法的典型用法代码示例。如果您正苦于以下问题:C++ LogManager::Check方法的具体用法?C++ LogManager::Check怎么用?C++ LogManager::Check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogManager
的用法示例。
在下文中一共展示了LogManager::Check方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
server_type |= SERVER_TYPE_MASTER;
//server_name = "Master Server";
//strcpy(mutex_name, MASTER_INSTANCE_MUTEX_NAME);
//sprintf(g_LogFile, "%sNet7_server.log", SERVER_LOGS_PATH);
//LogMessage("Net7 Master Server (Auth:%d, Global:%d, Master:%d)\n",
//SSL_PORT, GLOBAL_SERVER_PORT, MASTER_SERVER_PORT);
}
else if ((strncmp(argv[i], "/PORT:", 6) == 0) && !(server_type & SERVER_TYPE_SECTOR))
{
server_type |= SERVER_TYPE_SECTOR;
port = atoi(argv[i] + 6);
//sprintf(mutex_name, SECTOR_INSTANCE_MUTEX_NAME, port);
//server_name = "Sector Server";
//sprintf(g_LogFile, "%ssector_server_%d.log", SERVER_LOGS_PATH, port);
//LogMessage("Net7 Sector Server (Port %d)\n", port);
}
else if ((strncmp(argv[i], "/MAX_SECTORS:", 13) == 0) && (server_type & SERVER_TYPE_SECTOR))
{
max_sectors = atoi(argv[i] + 13);
}
else
{
printf("Net7 Usage:\n\n");
printf("to run the main server:\n");
printf(" Net7 /MASTER /ADDRESS:(ip address)\n\n");
printf("to run a sector server:\n");
printf(" Net7 /PORT:3500 /ADDRESS:(ip address) /MAX_SECTORS:(num sectors)\n\n");
return 1;
}
}
}
ip_address = inet_addr(address);
if ((port < 3500) || (port > 32767))
{
#ifdef WIN32
::MessageBox(NULL, "Invalid /PORT specified for Sector Server.", "Net7", MB_ICONERROR);
#else
printf("Invalid /PORT specified for Sector Server.\n");
#endif
return 1;
}
if ((max_sectors < 1) || (max_sectors > 128))
{
#ifdef WIN32
::MessageBox(NULL, "Invalid /MAX_SECTORS specified for Sector Server.", "Net7", MB_ICONERROR);
#else
printf("Invalid /MAX_SECTORS specified for Sector Server.\n");
#endif
return 1;
}
#ifdef WIN32
// First, make sure we only have one instance of the Global Server running
HANDLE instance_mutex = ::CreateMutex(NULL, TRUE, mutex_name);
if (instance_mutex == INVALID_HANDLE_VALUE)
{
::MessageBox(NULL, "Error creating instance mutex.", "Net7", MB_ICONERROR);
return 1;
}
// if we did not create this mutex then .. another instance
// is already running
if (::GetLastError() == ERROR_ALREADY_EXISTS)
{
// close the mutex
::CloseHandle(instance_mutex);
::MessageBox(NULL, "Another instance of the Net-7 Server is already running.", "Net7", MB_ICONERROR);
return 1;
}
#endif
{
char logFile[18];
time_t currentTime;
struct tm *timeData;
time(¤tTime);
timeData = localtime(¤tTime);
snprintf(logFile, 18, "Net7_%.4d%.2d%.2d.log", timeData->tm_year + 1900, timeData->tm_mon + 1, timeData->tm_mday);
g_Log.SetFileName(logFile);
g_LogDebug.SetFileName("Net7_debug.log");
g_LogError.SetFileName("Net7_error.log");
}
g_LogManager.Check();
ServerManager server_manager(server_type, ip_address, max_sectors);
server_manager.Run();
#ifdef WIN32
::CloseHandle(instance_mutex);
#endif
return 0;
}