#ifndef shaveDebug_h #define shaveDebug_h // Shave and a Haircut // (c) 2019 Epic Games // US Patent 6720962 #ifndef _DEBUG #define INFO(msg) #define ENTER() #define LEAVE() return #define RETURN(value) return (value) #else #ifdef __GNUG__ # define DEBUGFUNC __PRETTY_FUNCTION__ #else # ifdef _WIN32 # define DEBUGFUNC __FUNCTION__ # else # define DEBUGFUNC __func__ # endif #endif #define ENTER() shaveDebug::enter(DEBUGFUNC, __LINE__, __FILE__) #define LEAVE() { shaveDebug::leave(DEBUGFUNC, __LINE__, __FILE__); return; } #define RETURN(value) { shaveDebug::leave(DEBUGFUNC, __LINE__, __FILE__); return (value); } #define INFO(msg) shaveDebug::logMsg(msg, __LINE__, __FILE__) #include #include #include class shaveDebug { public: static void enter( MString method, unsigned int lineNumber, const char* file ); static void indent(); static void init(); static void leave( MString method, unsigned int lineNumber, const char* file ); static void logMsg( MString msg, unsigned int lineNumber, const char* file ); static void outputHeader( const char* tag, MString method, unsigned int lineNumber, const char* file ); private: static bool mInitialized; static FILE* mLogFile; static MStringArray mStack; static unsigned int mStackDepth; }; #endif #endif