Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Log.h

Go to the documentation of this file.
00001 /* SimData: Data Infrastructure for Simulations
00002  * Copyright (C) 2002 Mark Rose <tm2@stm.lbl.gov>
00003  * 
00004  * This file is part of SimData.
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00021 
00027 #ifndef __SIMDATA_LOG_H__
00028 #define __SIMDATA_LOG_H__
00029 
00030 
00031 #include <cstdio>
00032 #include <string>
00033 
00034 #include <SimData/LogStream.h>
00035 #include <SimData/Namespace.h>
00036 #include <SimData/Export.h>
00037 
00038 
00039 NAMESPACE_SIMDATA
00040 
00043 inline void error(std::string const &msg) {
00044         std::cerr << "SIMDATA fatal error:" << std:: endl;
00045         std::cerr << msg << std::endl;
00046         ::exit(1);
00047 }
00048 
00056 inline SIMDATA_EXPORT logstream&
00057 log()
00058 {
00059         //static logstream logstrm(std::cerr);
00060         static logstream *logstrm = 0;
00061         if (logstrm == 0) logstrm = new logstream(std::cerr);
00062         return *logstrm;
00063 }
00064 
00071 #ifdef SIMDATA_NDEBUG
00072 # define SIMDATA_LOG(C,P,M)
00073 #else
00074 # define SIMDATA_LOG(C,P,M) simdata::log() << simdata::loglevel(C,P) << M << std::endl
00075 #endif
00076 
00078 enum { LOG_BULK, LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ALERT, LOG_ERROR };
00079 
00085 enum { 
00086         LOG_NONE      = 0x00000000, 
00087         LOG_TYPE      = 0x00000001, 
00088         LOG_ARCHIVE   = 0x00000002,
00089         LOG_REGISTRY  = 0x00000004,
00090         LOG_ALL       = 0xffffffff
00091 };
00092 
00093 
00094 NAMESPACE_SIMDATA_END
00095 
00096 
00097 #endif // __SIMDATA_LOG_H__
00098 

SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:38 2003, using Doxygen 1.2.18.

[SF.net]