Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MJLogger.hh

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00003 //                                                                           //
00004 //                         MAJORANA Simulation                               //
00005 //                                                                           //
00006 //      This code implementation is the intellectual property of the         //
00007 //      MAJORANA Collaboration. It is based on Geant4, an intellectual       //
00008 //      property of the RD44 GEANT4 collaboration.                           //
00009 //                                                                           //
00010 //                        *********************                              //
00011 //                                                                           //
00012 //    Neither the authors of this software system, nor their employing       //
00013 //    institutes, nor the agencies providing financial support for this      //
00014 //    work  make  any representation or  warranty, express or implied,       //
00015 //    regarding this software system or assume any liability for its use.    //
00016 //    By copying, distributing or modifying the Program (or any work based   //
00017 //    on on the Program) you indicate your acceptance of this statement,     //
00018 //    and all its terms.                                                     //
00019 //                                                                           //
00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00021 //---------------------------------------------------------------------------//
00032 // Begin description of class here
00039 // End class description
00040 //
00045 // 
00046 // --------------------------------------------------------------------------//
00056 // --------------------------------------------------------------------------//
00057 
00058 #ifndef _MJLOGGER_HH
00059 #define _MJLOGGER_HH
00060 
00061 #include <iostream>
00062 
00063 using namespace std;
00064 
00065 //---------------------------------------------------------------------------//
00066 #define ERRLINE_HACK_1(line)   #line
00067 #define ERRLINE_HACK_2(line)   ERRLINE_HACK_1(line)
00068 
00069 #ifdef MJLog
00070 #undef MJLog
00071 #endif
00072 #define MJLog(sev) MJLogger::msg( MJLogger::sev, __FILE__ "(" ERRLINE_HACK_2(__LINE__) ")", 0 )
00073 
00074 //---------------------------------------------------------------------------//
00075 
00076 class MJLogger 
00077 {
00078 public:
00079 
00080   // a severity enum is defined; use only these values
00081   enum Severity {debugging=-1, trace=0, routine, warning, error, fatal};
00082    //   fatal:          The message is related to a condition preventing
00083   //                    further execution of the program.  ErrLogger will
00084   //                    terminate the program.  Programmers should not call
00085   //                    abort or exit themselves.
00086 
00087   //    error:          A condition exists such that requested result
00088   //                    or action can not be produced.  This is a serious
00089 
00090   //    warning:        The result is produced, but may not be
00091   //                    what's desired due to an unexpected condition
00092 
00093   //    routine:        Nothing known to be wrong with the result;
00094   //                    messages that are always produced in normal
00095   //                    operation
00096 
00097   //    trace:          Messages about the flow of program control
00098   //                    and which optional operations took place.
00099   //                    (This is the default if nothing is defined)
00100   
00101   //    debugging:      Information in addition to the above
00102 
00103  // members
00104   static Severity GetSeverity() { return _minSeverity; }
00105   static ostream& msg( MJLogger::Severity severity, 
00106                        const char* facility, 
00107                        const char* code );
00108 
00109   static void SetSeverity(Severity sever){ _minSeverity = sever;}
00110   static void endlog(ostream& s);
00111 
00112 protected:
00113  //default constructor
00114   MJLogger();
00115 
00116   //copy constructor
00117   MJLogger(const MJLogger &);
00118 
00119   //destructor
00120   ~MJLogger();
00121 
00122   //public interface
00123 
00124   //protected members
00125 protected:
00126 
00127 
00128   //private  members
00129 private:
00130   static char* toString(Severity);
00131 
00132   static ostream* _myOstream;
00133   static ostream* _myErrstream;
00134   static ostream* _myNullstream;
00135 
00136   static Severity _minSeverity;
00137 
00138   static bool _doPrint;
00139 };
00140 //void endlog(ostream& s);
00141 ostream& endlog(ostream& s);
00142 //ostream& operator << (ostream& os, string str)
00143 
00144 #endif

Generated on Mon Nov 29 16:58:52 2004 for Majorana Simulation by  doxygen 1.3.9.1