当前位置: 首页>>代码示例>>C++>>正文


C++ InitLog函数代码示例

本文整理汇总了C++中InitLog函数的典型用法代码示例。如果您正苦于以下问题:C++ InitLog函数的具体用法?C++ InitLog怎么用?C++ InitLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了InitLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CCConfig

bool CSystemEnv::Init( const char *file , const char *logpath , const char *userfile , const char *logname )
{
	_user_file_path = userfile ;

	_config = new CCConfig( file ) ;
	if ( _config == NULL ) {
		printf( "CSystemEnv::Init load config file %s failed\n", file ) ;
		return false ;
	}

	char temp[256] = {0} ;
	// 如果配置文件配置了工作日志目录
	if ( GetString( "log_dir", temp ) ) {
		InitLog( temp, logname ) ;
	} else {
		InitLog( logpath , logname ) ;
	}

	// 初始化等待队列线程
	if ( ! _waitgroup->Init() ) {
		printf( "CSystemEnv::Init wait group failed\n" ) ;
		return false ;
	}

	// 初始化MSG服务器
	if ( ! _msg_server->Init( this ) )
	{
		printf( "CSystemEnv::Init cas server init failed\n" ) ;
		return false ;
	}

	return true ;
}
开发者ID:caocf,项目名称:workspace-kepler,代码行数:33,代码来源:systemenv.cpp

示例2: scan_DGSIGN

/* DGSIGN="V.R.P/Y.M.D" */
void scan_DGSIGN(DGC*Conn,const char *mysig){
	if( mysig ){
		char vf[8];
		char vs[6][32];
		CStr(ver,32);
		CStr(date,32);
		int i;
		for( i = 0; i < 6; i++ )
			vf[i] = 'x';
		ver[0] = date[0] = 0;
		Xsscanf(mysig,"%[^/]/%s",AVStr(ver),AVStr(date));
		sscanf(ver,"%c.%c.%c",&vf[0],&vf[1],&vf[2]);
		sscanf(date,"%c.%c.%c",&vf[3],&vf[4],&vf[5]);
		Xsscanf(VERSION,"%[^.].%[^.].%s",
			FVStr(vs[0]),FVStr(vs[1]),FVStr(vs[2]));
		Xsscanf(DATE,"%s %[^,], %s",
			FVStr(vs[4]),FVStr(vs[5]),FVStr(vs[3]));
		for( i = 0; i < 6; i++ ){
			if( strchr("-0xX",vf[i]) ){
				vs[i][0] = vf[i];
				vs[i][1] = 0;
			}
		}
		Xsprintf(FVStr(_VERSION),"%s.%s.%s",vs[0],vs[1],vs[2]);
		Xsprintf(FVStr(_DATE),"%s %s, %s",vs[4],vs[5],vs[3]);
		InitLog("DGSIGN VERSION: %s\n",_VERSION);
		InitLog("DGSIGN DATE: %s\n",_DATE);
	}
}
开发者ID:2dot4,项目名称:Psiphon3-for-Linux,代码行数:30,代码来源:version.c

示例3: CCConfig

bool CSystemEnv::Init( const char *file , const char *logpath , const char *userfile , const char *logname )
{
	_user_file_path = userfile ;

	_config = new CCConfig( file ) ;
	if ( _config == NULL ) {
		printf( "CSystemEnv::Init load config file %s failed\n", file ) ;
		return false ;
	}

	char temp[256] = {0} ;
	// 如果配置文件配置了工作日志目录
	if ( GetString( "log_dir", temp ) ) {
		InitLog( temp, logname ) ;
	} else {
		InitLog( logpath , logname ) ;
	}

	if ( ! _rediscache->Init(this) ) {
		printf( "CSystemEnv::Init redis cache failed\n" ) ;
		return false ;
	}

	if ( ! _node_client->Init(this) ) {
		printf( "CSystemEnv::Init node client failed\n" ) ;
		return false ;
	}
	// 初始化MSG服务器
	if ( ! _msg_server->Init( this ) ){
		printf( "CSystemEnv::Init msg server init failed\n" ) ;
		return false ;
	}
	// 初始化发布服务
	if ( ! _publisher->Init(this) ) {
		printf( "CSystemEnv::Init publisher server failed\n" ) ;
		return false ;
	}

	// 初始化管理部件
	for ( int i = 0; i < MAX_MSGHANDLE; ++ i ) {
		if ( _msghandler[i] == NULL )
			continue ;
		_msghandler[i]->Init( this ) ;
	}

	// 初始MSG与中心同步客户
	if ( ! _msgclient->Init(this) ) {
		printf( "CSystemEnv::Init syn client failed\n" ) ;
		return false ;
	}

	return true ;
}
开发者ID:caocf,项目名称:workspace-kepler,代码行数:53,代码来源:systemenv.cpp

示例4: DoTest

/*
 * This test inspects the same window station aspects that are used in the
 * Cygwin fhandler_console.cc!fhandler_console::create_invisible_console()
 * function, see:
 *   https://github.com/cygwin/cygwin/blob/7b9bfb4136f23655e243bab89fb62b04bdbacc7f/winsup/cygwin/fhandler_console.cc#L2494
 */
VOID DoTest(HWND hWnd)
{
    HWINSTA hWinSta;
    LPCWSTR lpszWinSta = L"Test-WinSta";
    BOOL bIsItOk;
    LOG_FILE LogFile;
    WCHAR szBuffer[2048];

    bIsItOk = InitLog(&LogFile, L"test_winsta.log", szBuffer, sizeof(szBuffer));
    if (!bIsItOk)
    {
        MessageBoxW(hWnd, L"Could not create the log file, stopping test now...", L"Error", MB_ICONERROR | MB_OK);
        return;
    }

    /* Switch output to UTF-16 (little endian) */
    WriteToLog(&LogFile, "\xFF\xFE", 2);

    WriteToLogPrintf(&LogFile, L"Creating Window Station '%s'\r\n", lpszWinSta);
    hWinSta = CreateWindowStationW(lpszWinSta, 0, WINSTA_ALL_ACCESS, NULL);
    WriteToLogPrintf(&LogFile, L"--> Returned handle 0x%p ; last error: %lu\r\n", hWinSta, GetLastError());

    if (!hWinSta)
    {
        WriteToLogPuts(&LogFile, L"\r\nHandle is NULL, cannot proceed further, stopping the test!\r\n\r\n");
        return;
    }

    WriteToLogPrintf(&LogFile, L"Enumerate desktops on Window Station '%s' (0x%p) (before process attach)\r\n", lpszWinSta, hWinSta);
    bIsItOk = EnumDesktopsW(hWinSta, EnumDesktopProc, (LPARAM)&LogFile);
    WriteToLogPrintf(&LogFile, L"--> Returned %s ; last error: %lu\r\n",
                     (bIsItOk ? L"success" : L"failure"), GetLastError());

    WriteToLogPrintf(&LogFile, L"Setting current process to Window Station '%s' (0x%p)\r\n", lpszWinSta, hWinSta);
    bIsItOk = SetProcessWindowStation(hWinSta);
    WriteToLogPrintf(&LogFile, L"--> Returned %s ; last error: %lu\r\n",
                     (bIsItOk ? L"success" : L"failure"), GetLastError());

    WriteToLogPrintf(&LogFile, L"Enumerate desktops on Window Station '%s' (0x%p) (after process attach, before allocating console)\r\n", lpszWinSta, hWinSta);
    bIsItOk = EnumDesktopsW(hWinSta, EnumDesktopProc, (LPARAM)&LogFile);
    WriteToLogPrintf(&LogFile, L"--> Returned %s ; last error: %lu\r\n",
                     (bIsItOk ? L"success" : L"failure"), GetLastError());

    WriteToLogPrintf(&LogFile, L"Allocating a new console on Window Station '%s' (0x%p)\r\n", lpszWinSta, hWinSta);
    bIsItOk = AllocConsole();
    WriteToLogPrintf(&LogFile, L"--> Returned %s ; last error: %lu\r\n",
                     (bIsItOk ? L"success" : L"failure"), GetLastError());

    WriteToLogPrintf(&LogFile, L"Enumerate desktops on Window Station '%s' (0x%p) (after allocating console)\r\n", lpszWinSta, hWinSta);
    bIsItOk = EnumDesktopsW(hWinSta, EnumDesktopProc, (LPARAM)&LogFile);
    WriteToLogPrintf(&LogFile, L"--> Returned %s ; last error: %lu\r\n",
                     (bIsItOk ? L"success" : L"failure"), GetLastError());

    WriteToLogPrintf(&LogFile, L"Now closing Window Station '%s' (0x%p)\r\n", lpszWinSta, hWinSta);
    bIsItOk = CloseWindowStation(hWinSta);
    WriteToLogPrintf(&LogFile, L"--> Returned %s ; last error: %lu\r\n\r\n",
                     (bIsItOk ? L"success" : L"failure"), GetLastError());

    CloseLog(&LogFile);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:66,代码来源:winstation.c

示例5: _SINGLE

void CDebug::Initialize()
{
	m_pDevice = _SINGLE(CDevice)->GetDevice();
	if(!m_pDevice)
		return;
	_SINGLE(CTimeManager)->Init();
	//CreateVertexBuffer();

	//memset(&m_tGridMaterial, 0, sizeof(D3DMATERIAL9));
	//m_tGridMaterial.Diffuse.a = 1.f;
	//m_tGridMaterial.Diffuse.r = 1.f;
	//m_tGridMaterial.Diffuse.g = 0.8f;
	//m_tGridMaterial.Diffuse.b = 1.f;
	//m_tGridMaterial.Power = 0.2f;
	//m_tGridMaterial.Specular = m_tGridMaterial.Diffuse;
	//m_tGridMaterial.Ambient = m_tGridMaterial.Diffuse;

	//m_pTerrain = new CTerrainMesh;

	//m_pTerrain->Initialize();

	InitFont();
	InitLog();
	InitLine();

	//AddText3D( D3DXVECTOR3(10, 3, 10), _T("3D텍스트다!") );

}
开发者ID:qiomoip,项目名称:space-express,代码行数:28,代码来源:Debug.cpp

示例6: vector2d

//-----------------implementation of windows class-------------------------------
Window::Window (int *argc, char *argv[], int window_width, int window_height, const char *window_title)
{
	//init camera
	camera.width = window_width;
	camera.height = window_height;
	is_close = false;
	camera.center = vector2d (0, 2.0);
	camera.scale = 5.0;
	//init keyboard
	for (int i = 0; i < 256; i++)
		keys[i] = false;

	//start logging
	InitLog ();

	//create window
	glutInit (argc, argv);
	glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE);
	glutInitWindowSize (camera.width, camera.height);
	handle = glutCreateWindow (window_title);

	//set callbacks
	glutDisplayFunc (display);
	glutReshapeFunc (reshape);
	glutCloseFunc (close);
	glutKeyboardFunc (key_down);
	glutKeyboardUpFunc (key_up);
	glutMotionFunc (mouse_move);
	glutPassiveMotionFunc (mouse_move);
	glutMouseFunc (mouse_press);
	glutMouseWheelFunc (mouse_wheel);
	log (LOG_INFO, "Window \"%s\" created succesfully", window_title);
}
开发者ID:kachkov98,项目名称:VerletPhysics,代码行数:34,代码来源:window.cpp

示例7: MsgObject

    Dss1CallForGate::Dss1CallForGate(Dss1CallForGate::Profile &profile,
        ISDN::ICallbackDss::IncommingCallParametrs par) : 
        MsgObject(profile.m_infra->Domain().getMsgThread()),
		m_checkProfile(profile),
		m_stat(profile.m_stat->IncomingCall()),
        m_infra(*profile.m_infra),
        m_gate(*profile.m_owner),
		m_waitAnswerTimer(this, &T::WaitAnswerTimeout),
        m_isIncomingCall(true),
		m_isDeleted(false),
        m_isAddressComplete(false),
		m_isAllerted(false),
		m_isConnected(false),
		m_addressCompleteSize(profile.m_addressComplete),
		m_sendAlertingTone(profile.m_sendAlertingTone),
        m_calledNumber(par.m_callParams->GetCalled()),
        m_callingNumber(par.m_callParams->GetCalling()),
	    m_server(m_infra.Domain(), this),
        m_dss1Call(*this),
		m_interfaceNumber(-1)
    {
		ESS_ASSERT(par.m_callParams->InterfaceNumber().IsInited());
        ESS_ASSERT( par.m_bindToDssCall->Connect(m_dss1Call) );
	
		InitCallInfo();

		InitLog(*profile.m_logCreator.Clear());

		if(m_log->LogActive(m_infoTag))
		{
			*m_log << m_infoTag << "Created. Dss1->Sip. Dss1 call: " 
				<< par.m_unicCallName << iLogW::EndRecord;
		}
		LinkToBChannel(par.m_callParams->InterfaceNumber(), par.m_callParams->GetAckBchans());
    }
开发者ID:ixc-software,项目名称:lucksi,代码行数:35,代码来源:Dss1CallForGate.cpp

示例8: NewBasicState

lua_State *
Lua::NewFullState()
{
  lua_State *L = NewBasicState();

  InitLog(L);
  InitPersistent(L);
  InitTimer(L);
  InitMap(L);
  InitBlackboard(L);
  InitDialogs(L);
  InitLegacy(L);
  InitAirspace(L);
  InitTask(L);
  InitSettings(L);
  InitWind(L);
  InitLogger(L);
  InitTracking(L);
  InitReplay(L);
  InitInputEvent(L);

  {
    SetPackagePath(L,
                   WideToUTF8Converter(LocalPath(_T("lua" DIR_SEPARATOR_S "?.lua")).c_str()));
  }

  return L;
}
开发者ID:staylo,项目名称:XCSoar,代码行数:28,代码来源:Full.cpp

示例9: m_ShouldColorOutput

cMCLogger::cMCLogger(void):
	m_ShouldColorOutput(false)
{
	AString FileName;
	Printf(FileName, "LOG_%d.txt", (int)time(NULL));
	InitLog(FileName);
}
开发者ID:Dam63,项目名称:MCServer,代码行数:7,代码来源:MCLogger.cpp

示例10: main

main(int argc, char *argv[])
{
    if (TestAndLock()) {
        fprintf(stderr, "Another unwind running or abandoned, please check\n");
        exit(EXIT_FAILURE);
    }
    ParseArgs(argc, argv);

    InitSignals();

    InitLog();

    if (chdir(CodaUserDir)) {
        RemoveLock();
        Die("Could not cd into %s", CodaUserDir);
    }
    if (InitDB(DataBaseName)) {
        RemoveLock();
        fprintf(stderr, "Could not connect to database %s", DataBaseName);
        exit(EXIT_FAILURE);
    }
    LogMsg(100, LogLevel, LogFile, "Enter ProcessEachUser");
    ProcessEachUser();
    RemoveLock();
    Log_Done();
}
开发者ID:cmusatyalab,项目名称:coda,代码行数:26,代码来源:advice_unwind.c

示例11: main

int main(int argc, char* argv[])
{
    //------------------------------------
    ENGINE_HANDLE Engine;
    //------------------------------------


    if (argc > 1){
        if ((strcasecmp(argv[1], "--help") == 0) ||
            (strcasecmp(argv[1], "-h") == 0) ||
            (strcasecmp(argv[1], "/help") == 0) ||
            (strcasecmp(argv[1], "/?") == 0) ||
            (strcasecmp(argv[1], "/h") == 0)){

        PrintAllTests();
        return 0;
        }
    }


    printf("\n==================================================\n");
    printf("  Automated Unit Test of SegmentExecutionEngine\n");
    printf("==================================================\n\n");

    InitLog();

    Engine = SeCreateSegmentEngine(55);
    
    //
    //  The constructor registers the command.
    //
    TestSegmentIsoClass Iso2Command(Engine);
    Iso2Command.SetIsoVerbose(true);

    //
    //  Personalize it
    //
    RegisterStaticCommands(Engine);
    RegisterIsoSegment(Engine);
    RegisterRampSegment(Engine);
    RegisterRepeatUntilSegment(Engine);
    RegisterAbortSegment(Engine);
    RegisterAbort2Segment(Engine);


    //
    //  Run the tests.
    //
    if (argc > 1) {
        ExecuteTest(argv[1], Engine);
    }
    else {
        ExecuteAllTests(Engine);
    }

	return 0;
}
开发者ID:michaelbecker,项目名称:mercury-common-libs,代码行数:57,代码来源:SegmentTest.cpp

示例12: BuildNetPool

void cParamServer::Init()
{
	mTupleCount = 0;
	BuildNetPool();

#if defined(OUTPUT_TRAINER_LOG)
	InitLog();
#endif
}
开发者ID:bssrdf,项目名称:DeepTerrainRL,代码行数:9,代码来源:ParamServer.cpp

示例13: main

int main(int argc, char* argv[])
{
    CommandLine::Init(argc, argv);
    InitLog();
    LogTest();
    DLogTest();
    PLogTest();
    return 0;
}
开发者ID:lincleejun,项目名称:chromeThread,代码行数:9,代码来源:main.cpp

示例14: InitLog

CLog::CLog(PWCHAR pFileName, CLog* pParentLog, __ulong FltCat, DEBUG_INFO_LEVEL FltLevel, __ulong DbgFltCat, DEBUG_INFO_LEVEL DbgFltLevel)
{
	m_hFile = INVALID_HANDLE_VALUE;
	m_pwchFileName = NULL;
	m_FilterCat = FltCat;
	m_FilterLevel = FltLevel;
	m_DbgFilterCat = DbgFltCat;
	m_DbgFilterLevel = DbgFltLevel;
	InitLog(pFileName, pParentLog);
}
开发者ID:hackshields,项目名称:antivirus,代码行数:10,代码来源:Log.cpp

示例15: main

int main(int argc, char **argv)
{
	int ret = 0;
	LEVEL level = LOG_TRACE;
	OUTWAY outway = OUT_FILE;

	//测试未初始化就使用PRINTFLOG的情况
	ret = PRINTLOG(LOG_TRACE, "未初始化\n");
	printf("未初始化 返回值=%d\n", ret);

	//正常的使用方法
	InitLog(level, outway);
	ret = PRINTLOG(LOG_TRACE, ">>%s %s %d %s\n",__TIME__,  __FILE__, __LINE__, __FUNCTION__);
	printf("输出级别和初始化级别相同 返回值=%d\n", ret);
	PRINTLOG(LOG_TRACE, "<<%s %s %d %s\n",__TIME__,  __FILE__, __LINE__, __FUNCTION__);
	FreeLog();

	sleep(1);

	//输出级别不同于初始化级别的测试
	level = LOG_INFO;
	InitLog(level, outway);
	ret = PRINTLOG(LOG_TRACE, " %s %s %d %s\n",__TIME__,  __FILE__, __LINE__, __FUNCTION__);
	printf("输出级别低于初始化级别 返回值=%d\n", ret);
	PRINTLOG(LOG_WARNING, " %s %s %d %s\n",__TIME__,  __FILE__, __LINE__, __FUNCTION__);
	FreeLog();

	sleep(1);

	//测试多线程
	level = LOG_TRACE;
	InitLog(level, outway);
	
	pthread_t t1, t2;
	pthread_create(&t1, NULL, testThreadOne, NULL);
	pthread_create(&t2, NULL, testThreadTwo, NULL);

	pthread_join(t1, NULL);
	pthread_join(t2, NULL);
	
	FreeLog();
	return 0;
}
开发者ID:wht214035553,项目名称:log,代码行数:43,代码来源:test.c


注:本文中的InitLog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。