/******************************************************************************* Copyright (c) 2003, Robert Cowham and Vaccaperna Systems Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL VACCAPERNA SYSTEMS LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ /******************************************************************************* * Name: TraceUtils.h * * Author: Robert Cowham <robert@vaccaperna.co.uk> * * Description: * A Tracing utility * ******************************************************************************/ #ifndef _TRACEUTILS_H_ #define _TRACEUTILS_H_ #include <stdio.h> #include <crtdbg.h> #include <atlconv.h> BOOL Tracing(); inline void OutputTraceMsg(LPCTSTR msg) { OutputDebugString(msg); } inline void OutputTraceMsg(LPCTSTR msg, LPCTSTR param) { USES_CONVERSION; StrBuf s; s = T2A((LPTSTR)msg); s.Append(": "); s.Append(T2A((LPTSTR)param)); OutputDebugString(A2T(s.Text())); } inline void LogException(LPCTSTR proc) { USES_CONVERSION; StrBuf s; s = "p4com exception in procedure "; s.Append(T2A((LPTSTR)proc)); OutputDebugString(A2T(s.Text())); } #define TRACE(_Msg) if (Tracing()) { OutputTraceMsg(_Msg); } #define TRACE1(_Msg, Param1) if (Tracing()) { OutputTraceMsg(_Msg, Param1); } class Tracker { public: Tracker(LPCTSTR Stack) { USES_CONVERSION; if (Tracing()) { TRACE1(_T("p4com: Enter"), Stack); m_Procname.Set(T2A((LPTSTR)Stack)); } } ~Tracker() { USES_CONVERSION; TRACE1(_T("p4com: Leave"), A2T(m_Procname.Text())); } private: StrBuf m_Procname; }; #define STACK_TRACE(_Proc) Tracker _MyTracker(_T(_Proc)); #endif // _TRACEUTILS_H_
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11314 | Robert Cowham | Initial population of perforce_software version of P4OFC | ||
//guest/robert_cowham/perforce/API/p4com/main/src/TraceUtils.h | |||||
#4 | 5194 | Robert Cowham |
Changes (2005.1.0.0) Added Dropped() to detect dropped connections Added Input property to provide input e.g. for passwords Added FormatDateTime() as a convenience for calling C Runtime function (for VB use) Imported changes from p4ofc which made it more reliable. |
||
#3 | 4242 | Robert Cowham |
Fixed some String leaks. Fixed problem with writing to temporary files. Updated p4API to released version of 2003.2. Start of Delphi example. |
||
#2 | 3612 | Robert Cowham |
Version 1.0.0.2 New interface for ServerVersion. New put property ArrayVarVar which is the same as ArrayVar but takes an Array of Variants rather than strings (for Lisp compatibility!). |
||
#1 | 3525 | Robert Cowham | Initial release |