• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/CVUT/diplomka/Automata_editor/include/utility/dbglog.h

Go to the documentation of this file.
00001 #ifndef _DBGLOG_H_1638486468879_
00002 #define _DBGLOG_H_1638486468879_
00003 
00004 #include <QtDebug>
00005 
00006 
00007 #define STRNUMB_HELP(x) #x
00008 #define STRNUMB(x) STRNUMB_HELP(x)
00009 
00010 // TODO: define in other way if __FUNCTION__ not defined - handle most possibilities
00011 // this is for gcc
00012 #if __STDC_VERSION__ < 199901L
00013 #   if __GNUC__ >= 2
00014 #       if defined(__PRETTY_FUNCTION__)
00015 #           define __func__ __PRETTY_FUNCTION__
00016 #       else
00017 #           define __func__ __FILE__ " / " STRNUMB(__LINE__) ": " << __FUNCTION__
00018 #       endif
00019 #   else
00020 #       define __func__ "<unknown>"
00021 #   endif
00022 #endif
00023 
00024 // in VS2005 it's defined as macro
00025 #if defined(__FUNCTION__)
00026 #   define CURRENT_FUNCTION_NAME __FUNCTION__
00027 #elif defined(__func__)
00028 #   define CURRENT_FUNCTION_NAME __func__
00029 #else
00030 #   define CURRENT_FUNCTION_NAME "<unknown>"
00031 #endif
00032 
00033 //! Debug logging macros - define own macros for granulating log messages
00034 #define DBGLOG_PURE(x) do { qDebug() << x; } while(false)
00035 
00036 //! Debugging macros with identifiers printed first (eg. define user macro #define DBGLOG_MODULE(x) DBGLOG("MODULE", x)
00037 #define DBGLOG_(id, x) DBGLOG_PURE("<"id">\t" << CURRENT_FUNCTION_NAME << "->" << x)
00038 
00039 //! General debugging macro
00040 #define DBGLOG(x) DBGLOG_("EDITOR", x)
00041 
00042 //! for easily parameters logging
00043 #define DBGPAR(PAR) #PAR << "=" << PAR << " "
00044 
00045 //! release messages (used qWarning, so make sure that QT_NO_WARNING_OUTPUT isn't defined)
00046 #define RELLOG_PURE(x) do { qWarning() << x; } while(false)
00047 #define RELLOG_(id, x) RELLOG_PURE("<"id">\t" << "->" << x)
00048 #define RELLOG(x) RELLOG_("EDITOR", x)
00049 
00050 
00051 #endif //_DBGLOG_H_1638486468879_

Generated on Tue Jan 4 2011 03:03:21 for Autoamata editor by  doxygen 1.7.0