From: <ad...@us...> - 2003-02-14 16:01:46
|
Update of /cvsroot/bdadev/CleverTelly In directory sc8-pr-cvs1:/tmp/cvs-serv26738 Added Files: DebugLog.cpp DebugLog.h cleverte.ico Log Message: Added in missed files --- NEW FILE: DebugLog.cpp --- ///////////////////////////////////////////////////////////////////////////// // $Id: DebugLog.cpp,v 1.1 2003/02/14 16:01:37 adcockj Exp $ ///////////////////////////////////////////////////////////////////////////// // Copyright (c) 2003 John Adcock. All rights reserved. ///////////////////////////////////////////////////////////////////////////// // // This file is subject to the terms of the GNU General Public License as // published by the Free Software Foundation. A copy of this license is // included with this software distribution in the file COPYING. If you // do not have a copy, you may obtain a copy by writing to the Free // Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details ///////////////////////////////////////////////////////////////////////////// // This was is a modified version of DebugLog.cpp v 1.21 // from the DScaler project ////////////////////////////////////////////////////////////////////////////// #include "StdAfx.h" #include "resource.h" #include "DebugLog.h" #include <sys/timeb.h> #include <time.h> #define DEBUGLOGFILENAME "CleverTelly.log" static FILE* debugLog = NULL; #ifdef _DEBUG static long DebugLogLevel = 2; #else static long DebugLogLevel = 1; #endif void LOG(int DebugLevel, LPCSTR Format, ...) { DWORD SysTime; struct _timeb TimeB; struct tm* Time; char Stamp[100]; va_list Args; // allow file to be closed at the end if(Format == NULL) { if (debugLog != NULL) { fclose(debugLog); debugLog = NULL; } return; } if (DebugLevel > DebugLogLevel) { return; } if (debugLog == NULL) { debugLog = fopen(DEBUGLOGFILENAME, "w"); } if (debugLog == NULL) { return; } SysTime = timeGetTime(); _ftime(&TimeB); Time = localtime(&TimeB.time); strftime(Stamp, sizeof(Stamp), "%y%m%d %H%M%S", Time); fprintf(debugLog, "%s.%03d(%03d)", Stamp, TimeB.millitm, SysTime % 1000); for(int i(0); i < DebugLevel + 1; ++i) { fputc(' ', debugLog); } va_start(Args, Format); vfprintf(debugLog, Format, Args); va_end(Args); fputc('\n', debugLog); } ///////////////////////////////////////////////////////////////////////////// // CVS Log // // $Log: DebugLog.cpp,v $ // Revision 1.1 2003/02/14 16:01:37 adcockj // Added in missed files // ///////////////////////////////////////////////////////////////////////////// --- NEW FILE: DebugLog.h --- ///////////////////////////////////////////////////////////////////////////// // $Id: DebugLog.h,v 1.1 2003/02/14 16:01:37 adcockj Exp $ ///////////////////////////////////////////////////////////////////////////// // Copyright (c) 2003 John Adcock. All rights reserved. ///////////////////////////////////////////////////////////////////////////// // // This file is subject to the terms of the GNU General Public License as // published by the Free Software Foundation. A copy of this license is // included with this software distribution in the file COPYING. If you // do not have a copy, you may obtain a copy by writing to the Free // Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details ///////////////////////////////////////////////////////////////////////////// #pragma once void LOG(int DebugLevel, LPCSTR format, ...); --- NEW FILE: cleverte.ico --- (This appears to be a binary file; contents omitted.) |