base/zz_log.h

Go to the documentation of this file.
00001 /* libzz
00002  *
00003  * This program is distributed under the GNU General Public License, version 2.
00004  * A copy of this license is included with this source.
00005  *
00006  * Copyright 2000-2006, Toni Thomsson <toni@tonjac.org> 
00007 */
00008 
00009 #ifndef zz_log_h
00010 #define zz_log_h
00011 
00012 #include <rislog.h>
00013 #include <zz_string.h>
00014 #include <zz_export.h>
00015 
00016 #ifdef _WIN32
00017         #include <zz_win_threadmutex.h>
00018 #endif
00019 
00020 // Description: Info (logga info som är bra för driftspersonal)
00021 #define _INFOPARAMS    LL_INFO   , 0, __LINE__, __FILE__
00022 
00023 // Description: Trace (logga in/ut i funktioner)
00024 #define _TRACEPARAMS   LL_TRACE  , 0, __LINE__, __FILE__
00025 
00026 // Description: Debug (logga innehåll i variabler)
00027 #define _DEBUGPARAMS   LL_DEBUG  , 0, __LINE__, __FILE__
00028 
00029 // Description:  Warning (logga varningar ej fel)
00030 #define _WARNINGPARAMS LL_WARNING, 0, __LINE__, __FILE__
00031 
00032 
00033 #ifndef _LAF
00034 // Description: Macro för radnummer + filnamn
00035 #define _LAF __LINE__, __FILE__      
00036 #endif
00037 
00038 /*
00039         Description:
00040         Logg
00041 
00042         Remarks:
00043         Wrapper kring RISLOG API:et
00044 
00045         Author: 
00046         Toni Thomsson, toni@tonjac.org
00047 
00048         Library:
00049         libzz.a libri_log.sl (HPUX) libzz.lib, rislog32.dll (win32)
00050 
00051         See Also:
00052         RISLOG API
00053 
00054         Platform:
00055         HPUX, win32
00056 */
00057 class ZZ_API CzzLog
00058 {      
00059 
00060 public:
00061 
00062         /*
00063                 Description:
00064                 Skapar ett logg-objekt
00065 
00066                 Remarks:
00067                 Skapar ett logg-objekt med applikationsnamn = "DEFAULT"
00068         */
00069         CzzLog( void );
00070 
00071         /*
00072                 Remarks: 
00073                 Skapar ett logg-objekt med applikationsnamn
00074         */
00075         CzzLog( const CzzString& app // IN, applikations namn
00076                                 ); 
00077 
00078         CzzLog( const CzzString& app, // IN, applikations namn
00079                         const CzzString& ini ); 
00080 
00081         /* 
00082                 Remarks: 
00083                 Kopierings konstruktor
00084         */
00085         CzzLog( CzzLog& obj  // IN, objekt som skall kopieras
00086                         );
00087 
00088         // Description: Destruktor
00089         ~CzzLog();
00090 
00091         /*
00092                 Description: 
00093                 Loggar ett meddelande
00094 
00095                 Remarks: 
00096                 format se printf(), 
00097                 Använd följande macron för de första tre argumenten
00098                 _DEBUGPARAMS, _TRACEPARAMS, _INFOPARAMS, _WARNINGPARAMS
00099                 eller loggnivå = LL_ERROR vid fel
00100 
00101                 See Also:
00102                 CzzLogException
00103 
00104         */
00105         LOGRET Print( const LOGLEVEL Level,             // IN, loggnivå
00106                                         const int ErrorCode,    // IN, felkod
00107                                         const int Row,                  // IN, radnummer
00108                                         const char* Module,             // IN, modul/filnamn
00109                                         const char* Message,    // IN, meddelande/format
00110                                         ...                                             // IN, parametrar
00111                                         );
00112 
00113         // Description: Logghantag
00114         HLOG GetHandle();
00115 
00116 private:
00117 
00118         void Init( const CzzString& app );
00119         void Init( const CzzString& app, const CzzString& ini );
00120         static HLOG m_Handle;
00121         static short m_cRefs;
00122 
00123 #ifdef _WIN32
00124         static CzzWinThreadMutex m_Mutex;
00125 #endif
00126 
00127 };
00128 
00129 #endif
00130 

Generated on Thu Sep 21 21:45:41 2006 for tonjac.org MINI/C++ library by  doxygen 1.4.6-NO