void Grammar::verbose(int level, _In_z_ _Printf_format_string_ TCHAR const * const format, ...) const { if(level <= m_verboseLevel) { va_list argptr; va_start(argptr, format); _vtprintf(format, argptr); va_end(argptr); } }
static void DiffDir_printf( const _TCHAR* strFormat, ...) { if(DiffDir_IsQuiet())return; va_list args; va_start (args, strFormat); _vtprintf (strFormat, args); va_end (args); }
void ReportInfo(LPCTSTR pszMsg, ...) { va_list args; va_start(args, pszMsg); _tprintf(_T("Info: ")); _vtprintf(pszMsg, args); _tprintf(_T("\n\n")); va_end(args); }
void ReportError(LPCTSTR pszMsg, ...) { ++error; va_list args; va_start(args, pszMsg); _tprintf(_T("Error (%d): "), error); _vtprintf(pszMsg, args); _tprintf(_T("\n\n")); va_end(args); }
void ReportWarning(LPCTSTR pszMsg, ...) { ++warning; va_list args; va_start(args, pszMsg); _tprintf(_T("Warning (%d): "), warning); _vtprintf(pszMsg, args); _tprintf(_T("\n\n")); va_end(args); }
void lc_print(LPCTSTR lpszLocale,LPCTSTR lpszFormat,...){ va_list args; // va_start(args,lpszFormat); #if defined(_UNICODE) LPCTSTR lpszSvLc = _tsetlocale(LC_ALL,NULL); _tsetlocale(LC_ALL,lpszLocale); _vtprintf(lpszFormat,args); _tsetlocale(LC_ALL,lpszSvLc); #else oem_vprint(lpszFormat,args); #endif va_end(args); }
/////////////////////////////////////////////////////////////////////////////// // HandleNotify /////////////////////////////////////////////////////////////////////////////// void cUserNotifyStdout::HandleNotify( int level, const TCHAR* format, va_list& args ) { if(GetVerboseLevel() < level) return; // all verbose output now goes to stderr if(level < iUserNotify::V_VERBOSE) { _vtprintf(format, args); fflush( stdout ); } else { _vftprintf(stderr, format, args); fflush( stderr ); } }
void UILIB_API __Trace(LPCTSTR pszFormatString, ...) { #ifdef _DEBUG #if defined(UI_BUILD_FOR_WIN32) && !defined(UI_BUILD_FOR_WINCE) TCHAR szBuffer[300] = { 0 }; va_list args; va_start(args, pszFormatString); ::wvnsprintf(szBuffer, lengthof(szBuffer) - 2, pszFormatString, args); _tcscat(szBuffer, _T("\n")); va_end(args); ::OutputDebugString(szBuffer); #else va_list VAList; va_start(VAList, pszFormatString); _vtprintf(pszFormatString,VAList); va_end(VAList); #endif #endif }
// ******************************************** class CaptureReceiver ******************************************** void CaptureReceiver::vlog(_In_z_ _Printf_format_string_ TCHAR const * const format, va_list argptr) { _vtprintf(format,argptr); }
BOOL DbgPrint(__in LPCTSTR lpszFormatString, ...) { BOOL bResult = TRUE; va_list VAList; va_start(VAList, lpszFormatString); if (g_bSaveLogFile) { #if defined(DBG_THREADSAFE) OS_CAutoLock lock(s_mtxEntry); #endif if (!s_bLogPathInit) { SYSTEMTIME stime = {0}; GetLocalTime(&stime); #if defined(UNDER_CE) _stprintf(s_szLogFile, _T("%s\\log_%04d%02d%02d_%d.log"), g_bLogSavePath, stime.wYear, stime.wMonth, stime.wDay, GetTickCount()); #else _stprintf_s(s_szLogFile, MAX_PATH, _T("%s\\log_%04d%02d%02d_%d.log"), g_bLogSavePath, stime.wYear, stime.wMonth, stime.wDay, GetTickCount()); #endif s_bLogPathInit = true; } FILE* pFile = _tfopen(s_szLogFile, _T("a")); if (pFile != NULL) { fseek(pFile,SEEK_END,0); long cbSize = ftell(pFile); if (cbSize > MAX_LOG_FILE_SIZE) { fclose(pFile); { SYSTEMTIME stime = {0}; GetLocalTime(&stime); #if defined(UNDER_CE) _stprintf(s_szLogFile, _T("%s\\log_%04d%02d%02d_%d.log"), g_bLogSavePath, stime.wYear, stime.wMonth, stime.wDay, GetTickCount()); #else _stprintf_s(s_szLogFile, MAX_PATH, _T("%s\\log_%04d%02d%02d_%d.log"), g_bLogSavePath, stime.wYear, stime.wMonth, stime.wDay, GetTickCount()); #endif s_bLogPathInit = true; } pFile = _tfopen(s_szLogFile, _T("a")); if (pFile == NULL) { return FALSE; } } _vftprintf(pFile, lpszFormatString, VAList); fflush(pFile); fclose(pFile); pFile = NULL; } } else { #if defined(UNDER_CE) _vtprintf(lpszFormatString, VAList); #else TCHAR szBuf[MAX_PATH * 2] = {0}; _vstprintf_s(szBuf, MAX_PATH, lpszFormatString, VAList); OutputDebugString(szBuf); #endif } va_end(VAList); return bResult; }