00001 /* Logging.h 00002 00003 Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU General Public License 00007 as published by the Free Software Foundation; either version 2 00008 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 Or, point your browser to http://www.gnu.org/copyleft/gpl.html 00019 00020 */ 00021 00022 #if !defined(LOGGING_H) 00023 #define LOGGING_H 00024 00025 #include <qglobal.h> // For Q_ASSERT 00026 #include <qstring.h> // For QString 00027 00028 #include "freemheg.h" // For MHLogError 00029 00030 #define MHASSERT(f) Q_ASSERT(f) 00031 00032 extern int __mhlogoptions; 00033 extern void __mhlog(QString logtext); 00034 extern FILE *__mhlogStream; 00035 00036 #define MHLOG(__level,__text) \ 00037 do { \ 00038 if (__level & __mhlogoptions) \ 00039 __mhlog(__text); \ 00040 } while (0) 00041 00042 #define MHERROR(__text) \ 00043 do { \ 00044 if (MHLogError & __mhlogoptions) \ 00045 __mhlog(__text); \ 00046 throw "Failed"; \ 00047 } while (0) 00048 00049 #endif
1.5.5