Example #1
0
void CLoggable::AddLogText(bool debug, bool addtostatusbar, LPCTSTR line, va_list argptr)
{
	ASSERT(line != NULL);

	EMULE_TRY

#ifndef NEW_SOCKETS_ENGINE
	if (debug && !g_App.m_pPrefs->GetVerbose())
		return;
#endif //NEW_SOCKETS_ENGINE

	CString sBuffer;

	sBuffer.FormatV(line, argptr);

#ifndef NEW_SOCKETS_ENGINE
	#ifdef _DEBUG
		//SyruS (0.29c) view the log messages while shutting down at least in the debugger
		if (g_App.m_app_state != g_App.APP_STATE_RUNNING)
			TRACE("App Log: %s\n", sBuffer);

	#endif
	if (g_App.m_pMDlg)
		g_App.m_pMDlg->AddLogText(addtostatusbar, sBuffer, debug);	// debug log and normal log handled by the same subroutine now
#else //NEW_SOCKETS_ENGINE
	g_stEngine.AddLog(debug ? LOG_DEBUG : LOG_WARNING, sBuffer);
#endif //NEW_SOCKETS_ENGINE

#ifdef _DEBUG
	if (debug)
		::OutputDebugString(sBuffer + _T("\n"));
#endif

	EMULE_CATCH2
}
void FMLogOutputDebugString(LPCTSTR lpszFormat, ...)
{
    va_list argList;
    va_start(argList, lpszFormat);

    CString strMsg;
    strMsg.FormatV(lpszFormat, argList);

    va_end(argList);

    OutputDebugString(g_strFMLog + strMsg);
}
Example #3
0
BOOL CQListCtrl::SetFormattedText(int nRow, int nCol, LPCTSTR lpszFormat,...)
{
	CString csText;
	va_list vlist;
	
	ASSERT(AfxIsValidString(lpszFormat));
	va_start(vlist,lpszFormat);
	csText.FormatV(lpszFormat,vlist);
	va_end(vlist);
	
	return SetText(nRow,nCol,csText);
}
Example #4
0
static void Errorf( LPCTSTR pszFormat, ... )
{
    CString		str;

    va_list	argList;

    va_start( argList, pszFormat );

    str.FormatV( pszFormat, argList );

    ::MessageBox(NULL, (LPCTSTR) str, _T("WTLExcel Error"), MB_ICONHAND | MB_OK );

    return;
}
Example #5
0
void Logger::vprintf(bool verbose, const char * format, va_list ap)
{
	if(MainWindow && (!verbose || m_verbose))
	{
		CString tmp;
		tmp.FormatV(format, ap);
		MainWindow->Log(tmp);
	}

	if(verbose && !m_verbose)
        return;
    vfprintf(m_fp, format, ap);
    if(m_flush)
        fflush(m_fp);
}
Example #6
0
void CMainDlg::PrintText(LPCTSTR format, ...)
{
    if (format)
    {
        va_list args;
        va_start(args, format);

        CString strText;
        strText.FormatV(format, args);

        va_end(args);

        // POST到界面线程执行
        SPARK_INSTANCE_POST_MSG_EX(CMainDlg, DoInMainThread, strText);
    }
}
Example #7
0
void Logger::printf(bool verbose, const char * format, ...)
{
	if(MainWindow && (!verbose || m_verbose))
	{
	    va_list arg;
		va_start(arg, format);
		CString tmp;
		tmp.FormatV(format, arg);
		MainWindow->Log(tmp);
		va_end(arg);
	}

    if(verbose && !m_verbose)
        return;
    va_list arg;
    va_start(arg, format);
    vfprintf(m_fp, format, arg);
    va_end(arg);

    if(m_flush)
        fflush(m_fp);
}
Example #8
0
void CAxisLog::Add(int iFormat, const char *format, ...)
{
	if ( m_pLog == NULL )
		return;
	time_t now;
	now = time(NULL);
	struct tm lt;
	localtime_s(&lt,&now);
	fprintf( m_pLog, "%ld.%ld.%ld %02d:%02d:%02d ::", lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday, lt.tm_hour, lt.tm_min, lt.tm_sec );
	CString csText;
	va_list args;
	va_start(args, format);
	csText.FormatV(format, args);
	vfprintf(m_pLog, format, args);
	va_end(args);
	fprintf(m_pLog, "\n");
	fflush(m_pLog);
	if (Main->m_pcppAxisLogTab)
	{
		CLogTab * pLogTab = (CLogTab *)Main->m_pcppAxisLogTab->m_dcCurrentPage;
		if (pLogTab)
		{
			switch( iFormat )
			{
			case 0:
				pLogTab->AddText(csText, RGB(0, 0, 0));
				break;
			case 1:
				pLogTab->AddText(csText, RGB(255, 0, 0));
				break;
			case 2:
				pLogTab->AddText(csText, RGB(0, 0, 255));
				break;
			default:
				pLogTab->AddText(csText, RGB(0, 0, 0));
			}
		}
	}
}
void AddLog(LPCTSTR lpstrLog,...)
{
	if (!bOpened)
		return;
	try
	{
		CString			csBuffer;
		va_list			argList;

		// Format arguments
		va_start(argList, lpstrLog);
		csBuffer.FormatV( lpstrLog, argList);
		va_end( argList);
		// Write string
		myFile.WriteString( csBuffer);
		myFile.Flush();
	}
	catch (CException *pEx)
	{
		pEx->Delete();
		myFile.Abort();
	}
}