log.hxx

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Gerd v. Egidy                                   *
00003  *   gve@intra2net.com                                                     *
00004  *                                                                         *
00005  *   This library is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License version   *
00007  *   2.1 as published by the Free Software Foundation.                     *
00008  *                                                                         *
00009  *   This library is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU Lesser General Public License for more details.                   *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this program; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 #ifndef __LIBT2N_LOG
00020 #define __LIBT2N_LOG
00021 
00022 #include <iostream>
00023 #include <sstream>
00024 
00025 #define LOGGING
00026 
00027 #ifdef LOGGING
00028 
00029 #define LOGSTREAM(level,pipe) \
00030             do { \
00031                 std::ostream* streamptr; \
00032                 if ((streamptr=get_logstream(level))!=NULL) \
00033                     (*streamptr) << pipe << std::endl; \
00034             } while (0)
00035 
00036 #define OBJLOGSTREAM(obj,level,pipe) \
00037             do { \
00038                 std::ostream* streamptr; \
00039                 if ((streamptr=obj.get_logstream(level))!=NULL) \
00040                     (*streamptr) << pipe << std::endl; \
00041             } while (0)
00042 
00043 #define EXCEPTIONSTREAM(loglevel,exception,pipe) \
00044             do { \
00045                 std::ostringstream ostr; \
00046                 ostr << pipe; \
00047                 std::ostream* streamptr; \
00048                 if ((streamptr=get_logstream(loglevel))!=NULL) \
00049                     (*streamptr) << ostr.str() << std::endl; \
00050                 throw exception(ostr.str()); \
00051             } while (0)
00052 
00053 #else
00054 
00055 #define LOGSTREAM(level,pipe)
00056 #define OBJLOGSTREAM(obj,level,pipe)
00057 #define EXCEPTIONSTREAM(loglevel,exception,pipe)
00058 
00059 #endif
00060 
00061 #endif

Generated on Fri Sep 26 15:36:59 2008 for libt2n by  doxygen 1.5.6