Intra2net AG

log.hxx

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2006 by Intra2net AG - Gerd v. Egidy
00003 
00004 The software in this package is distributed under the GNU General
00005 Public License version 2 (with a special exception described below).
00006 
00007 A copy of GNU General Public License (GPL) is included in this distribution,
00008 in the file COPYING.GPL.
00009 
00010 As a special exception, if other files instantiate templates or use macros
00011 or inline functions from this file, or you compile this file and link it
00012 with other works to produce a work based on this file, this file
00013 does not by itself cause the resulting work to be covered
00014 by the GNU General Public License.
00015 
00016 However the source code for this file must still be made available
00017 in accordance with section (3) of the GNU General Public License.
00018 
00019 This exception does not invalidate any other reasons why a work based
00020 on this file might be covered by the GNU General Public License.
00021 */
00022 #ifndef __LIBT2N_LOG
00023 #define __LIBT2N_LOG
00024 
00025 #include <iostream>
00026 #include <sstream>
00027 
00028 #define LOGGING
00029 
00030 #ifdef LOGGING
00031 
00032 #define LOGSTREAM(level,pipe) \
00033             do { \
00034                 std::ostream* streamptr; \
00035                 if ((streamptr=get_logstream(level))!=NULL) \
00036                     (*streamptr) << pipe << std::endl; \
00037             } while (0)
00038 
00039 #define OBJLOGSTREAM(obj,level,pipe) \
00040             do { \
00041                 std::ostream* streamptr; \
00042                 if ((streamptr=obj.get_logstream(level))!=NULL) \
00043                     (*streamptr) << pipe << std::endl; \
00044             } while (0)
00045 
00046 #define EXCEPTIONSTREAM(loglevel,exception,pipe) \
00047             do { \
00048                 std::ostringstream ostr; \
00049                 ostr << pipe; \
00050                 std::ostream* streamptr; \
00051                 if ((streamptr=get_logstream(loglevel))!=NULL) \
00052                     (*streamptr) << ostr.str() << std::endl; \
00053                 throw exception(ostr.str()); \
00054             } while (0)
00055 
00056 #else
00057 
00058 #define LOGSTREAM(level,pipe)
00059 #define OBJLOGSTREAM(obj,level,pipe)
00060 #define EXCEPTIONSTREAM(loglevel,exception,pipe)
00061 
00062 #endif
00063 
00064 #endif

Generated on 13 May 2015 by  doxygen 1.6.1
© Intra2net AG 2024 | Legal | Contact