00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef Y2Log_h
00020 #define Y2Log_h
00021
00022 #include <iosfwd>
00023
00024 #include <iostream>
00025 using namespace std;
00026
00027 #include "stdutil.h"
00028 using namespace stdutil;
00029
00030 namespace Y2Log {
00031
00032 enum lclass {
00033
00034 C_Y2UI = 0,
00035 C_NC,
00036 C_NC_WIDGET,
00037 C_NC_IO,
00038 C_TRACE,
00039
00040 C_DBG
00041 };
00042
00043 extern std::ostream & get( unsigned which, unsigned level,
00044 const char * fil, const char * fnc, int lne );
00045
00046 extern std::ostream & dbg_get( const char * dbg_class, unsigned level,
00047 const char * fil, const char * fnc, int lne );
00048
00049 }
00050
00051 #define _LOG(c,l) Y2Log::get( c, l, __FILE__, __FUNCTION__, __LINE__ )
00052
00053 #define _DBG(c) _LOG( c, 0 )
00054 #define _MIL(c) _LOG( c, 1 )
00055 #define _WAR(c) _LOG( c, 2 )
00056 #define _ERR(c) _LOG( c, 3 )
00057 #define _SEC(c) _LOG( c, 4 )
00058 #define _INT(c) _LOG( c, 5 )
00059
00060 #define UIDBG _DBG(Y2Log::C_Y2UI)
00061 #define UIMIL _MIL(Y2Log::C_Y2UI)
00062 #define UIWAR _WAR(Y2Log::C_Y2UI)
00063 #define UIERR _ERR(Y2Log::C_Y2UI)
00064 #define UISEC _SEC(Y2Log::C_Y2UI)
00065 #define UIINT _INT(Y2Log::C_Y2UI)
00066
00067 #define NCDBG _DBG(Y2Log::C_NC)
00068 #define NCMIL _MIL(Y2Log::C_NC)
00069 #define NCWAR _WAR(Y2Log::C_NC)
00070 #define NCERR _ERR(Y2Log::C_NC)
00071 #define NCSEC _SEC(Y2Log::C_NC)
00072 #define NCINT _INT(Y2Log::C_NC)
00073
00074 #define WIDDBG _DBG(Y2Log::C_NC_WIDGET)
00075 #define WIDMIL _MIL(Y2Log::C_NC_WIDGET)
00076 #define WIDWAR _WAR(Y2Log::C_NC_WIDGET)
00077 #define WIDERR _ERR(Y2Log::C_NC_WIDGET)
00078 #define WIDSEC _SEC(Y2Log::C_NC_WIDGET)
00079 #define WIDINT _INT(Y2Log::C_NC_WIDGET)
00080
00081 #define IODBG _DBG(Y2Log::C_NC_IO)
00082 #define IOMIL _MIL(Y2Log::C_NC_IO)
00083 #define IOWAR _WAR(Y2Log::C_NC_IO)
00084 #define IOERR _ERR(Y2Log::C_NC_IO)
00085 #define IOSEC _SEC(Y2Log::C_NC_IO)
00086 #define IOINT _INT(Y2Log::C_NC_IO)
00087
00088
00089
00090
00091 #define DBG_CLASS 0
00092
00093 #define DDBG Y2Log::dbg_get( DBG_CLASS, 0, __FILE__, __FUNCTION__, __LINE__ )
00094 #define MDBG Y2Log::dbg_get( DBG_CLASS, 1, __FILE__, __FUNCTION__, __LINE__ )
00095 #define WDBG Y2Log::dbg_get( DBG_CLASS, 2, __FILE__, __FUNCTION__, __LINE__ )
00096 #define EDBG Y2Log::dbg_get( DBG_CLASS, 3, __FILE__, __FUNCTION__, __LINE__ )
00097 #define SDBG Y2Log::dbg_get( DBG_CLASS, 4, __FILE__, __FUNCTION__, __LINE__ )
00098 #define IDBG Y2Log::dbg_get( DBG_CLASS, 5, __FILE__, __FUNCTION__, __LINE__ )
00099
00100 #define D__ _DBG(Y2Log::C_TRACE)
00101 #define M__ _MIL(Y2Log::C_TRACE)
00102 #define W__ _WAR(Y2Log::C_TRACE)
00103 #define E__ _ERR(Y2Log::C_TRACE)
00104 #define S__ _SEC(Y2Log::C_TRACE)
00105 #define I__ _INT(Y2Log::C_TRACE)
00106
00107 #endif // Y2Log_h