Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OWTrace.h

Go to the documentation of this file.
00001 /*  OWTrace.h - tracing macros.
00002     Copyright (C) 2001-2004 Mark Weaver
00003     Written by Mark Weaver <mark@npsl.co.uk>
00004 
00005     Part of the Open-Win32 library.
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the
00018     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA  02111-1307, USA.
00020 */
00021 
00027 #ifndef OW32_OWTrace_h
00028 #define OW32_OWTrace_h
00029 
00030 #ifdef _DEBUG
00031 
00032 #include <cstdarg>
00033 #include <cstdio>
00034 #include <tchar.h>
00035 
00036 namespace OW32
00037 {
00038 
00039 inline void OWTrace(LPCTSTR lpszFormat, ...)
00040 {
00041     va_list vap;
00042     TCHAR szTraceBuffer[8192];
00043 
00044     va_start(vap, lpszFormat);
00045     _vsntprintf(szTraceBuffer, sizeof(szTraceBuffer)/sizeof(szTraceBuffer[0]), lpszFormat, vap);
00046     szTraceBuffer[sizeof(szTraceBuffer)/sizeof(szTraceBuffer[0]) - 1] = _T('\0');
00047     OutputDebugString(szTraceBuffer);
00048     va_end(vap);
00049 }
00050 
00051 };
00052 
00053 #else
00054 
00055 namespace OW32
00056 {
00057 
00058 inline void OWTrace(LPCTSTR, ...) 
00059 {
00060 }
00061 
00062 };
00063 
00064 #endif
00065 
00066 #define OWTRACE OW32::OWTrace
00067 
00068 #endif // OW32_OWTrace_h

Generated on Sun Jun 5 01:29:18 2005 for OW32 by  doxygen 1.3.9.1