#include "stdafx.h" #include "StatServer.h" #include #include class CCMDPrintLog : public CConsoleCMDSingleton { protected: virtual bool DoProcess() { SERLOG0(g_Log, "Flush log"); SERLOG0(g_SessionLog, "Flush log"); return true; } }; bool CStatServer::InitializeCommand() { #define INIT_COMMAND_FAILED(detail) TEXT("Command create failed - "##detail) #define ADD_COMMAND(cmdstring, cmdobject, errmsg_val) \ if(0 == (errmsg_val) && !GetCommandFactory()->AddCommand(cmdstring, new cmdobject)) { \ (errmsg_val) = INIT_COMMAND_FAILED(cmdstring); } const TCHAR* szErrorMessage = 0; ADD_COMMAND("flush", CCMDPrintLog, szErrorMessage); if(0 != szErrorMessage) { ERRLOG0(g_Log, szErrorMessage); return false; }; return true; }