libqutim 0.2.80.1

debug.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** qutIM - instant messenger
00004 **
00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
00006 **
00007 *****************************************************************************
00008 **
00009 ** $QUTIM_BEGIN_LICENSE$
00010 ** This program is free software: you can redistribute it and/or modify
00011 ** it under the terms of the GNU General Public License as published by
00012 ** the Free Software Foundation, either version 3 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00018 ** See the GNU General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU General Public License
00021 ** along with this program.  If not, see http://www.gnu.org/licenses/.
00022 ** $QUTIM_END_LICENSE$
00023 **
00024 ****************************************************************************/
00025 
00026 #ifndef DEBUG_H
00027 #define DEBUG_H
00028 
00029 // Include QDebug, because we want to redefine some symbols
00030 #include <QDebug>
00031 #include "libqutim_global.h"
00032 
00033 //#if !(defined(LIBQUTIM_LIBRARY) || defined(QUTIM_CORE))
00034 //extern qptrdiff qutim_plugin_id();
00035 //#endif
00036 
00037 namespace qutim_sdk_0_3
00038 {
00039     enum DebugLevel
00040     {
00041         DebugInfo = 0,
00042         DebugVerbose,
00043         DebugVeryVerbose
00044 #if 1
00045         ,
00046         Info = DebugInfo,
00047         Verbose = DebugVerbose,
00048         VeryVerbose = DebugVeryVerbose
00049 #endif
00050     };
00051 
00052     LIBQUTIM_EXPORT QDebug debug_helper(quint64, DebugLevel, QtMsgType);
00053 //  LIBQUTIM_EXPORT qptrdiff debug_area_helper(const char *str);
00054     LIBQUTIM_EXPORT void debugClearConfig();
00055     
00056 //#ifndef QUTIM_DEBUG_AREA
00057 //#if defined (LIBQUTIM_LIBRARY)
00058 //# define QUTIM_DEBUG_AREA "libqutim"
00059 //#elif defined (QUTIM_CORE)
00060 //# define QUTIM_DEBUG_AREA "core"
00061 //#else
00062 //# define QUTIM_DEBUG_AREA ""
00063 //#endif
00064 //  
00065 //  inline qptrdiff debug_area(const char *str)
00066 //  {
00067 //      static qptrdiff area = debug_area_helper(str);
00068 //      return area;
00069 //  }
00070 
00071 #if defined(LIBQUTIM_LIBRARY) || defined(QUTIM_CORE) || 1
00072     inline QDebug debug(DebugLevel level = Info)
00073     { return debug_helper(0, level, QtDebugMsg); }
00074     inline QDebug warning(DebugLevel level = Info)
00075     { return debug_helper(0, level, QtWarningMsg); }
00076     inline QDebug critical(DebugLevel level = Info)
00077     { return debug_helper(0, level, QtCriticalMsg); }
00078     inline QDebug fatal(DebugLevel level = Info)
00079     { return debug_helper(0, level, QtFatalMsg); }
00080 #else
00081     inline quint64 qutim_plugin_id()
00082     { return Q_UINT64_C(QUTIM_PLUGIN_ID); }
00083     inline QDebug debug(DebugLevel level = Info)
00084     { return debug_helper(qutim_plugin_id(), level, QtDebugMsg); }
00085     inline QDebug warning(DebugLevel level = Info)
00086     { return debug_helper(qutim_plugin_id(), level, QtWarningMsg); }
00087     inline QDebug critical(DebugLevel level = Info)
00088     { return debug_helper(qutim_plugin_id(), level, QtCriticalMsg); }
00089     inline QDebug fatal(DebugLevel level = Info)
00090     { return debug_helper(qutim_plugin_id(), level, QtFatalMsg); }
00091 #endif
00092 }
00093 #endif // DEBUG_H
00094