TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tsp_simple_trace.h

Go to the documentation of this file.
00001 
00038 #ifndef __TSP_SIMPLE_TRACE_H
00039 #define __TSP_SIMPLE_TRACE_H
00040 
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 
00044 #define SIMPLE_TRACE_FUNC(level,src,func,text) \
00045 { \
00046     static int _strace_debug_level = -1; \
00047     if (_strace_debug_level<0) { \
00048         if (getenv ("STRACE_DEBUG") != (char *)0) {\
00049             _strace_debug_level = atoi(getenv("STRACE_DEBUG")); \
00050         } else {\
00051             _strace_debug_level = 0; }\
00052     }\
00053     if (_strace_debug_level >= level ) { \
00054            printf("%7s||%s##%s##%d: ", src, __FILE__, func, __LINE__); \
00055            printf text; printf("\n"); fflush(stdout);\
00056     }\
00057 } 
00058 #ifdef __GNUC__       
00059 #  define SIMPLE_TRACE(level,src,text) SIMPLE_TRACE_FUNC(level,src,__FUNCTION__,text)
00060 #else 
00061 #  define SIMPLE_TRACE(level,src,text) SIMPLE_TRACE_FUNC(level,src,"where?",text)
00062 #endif
00063                                   
00064 #ifdef  USE_STRACE
00065 # define STRACE_IO(text) SIMPLE_TRACE(5, "i/o", text)
00066 # define STRACE_DEBUG(text) SIMPLE_TRACE(4, "debug", text)
00067 # define STRACE_INFO(text) SIMPLE_TRACE(3, "Info", text)
00068 # define STRACE_TEST(text) SIMPLE_TRACE(1, "TEST", text)
00069 #else
00070 # define STRACE_IO(text)
00071 # define STRACE_DEBUG(text)
00072 # define STRACE_INFO(text)
00073 # define STRACE_TEST(text)
00074 #endif
00075 
00076 #define STRACE_WARNING(text) SIMPLE_TRACE(2, "WarninG", text)
00077 #define STRACE_ERROR(text) SIMPLE_TRACE(0,"ERROR", text)
00078 
00079 #endif /*_SIMPLE_TRACE_H*/
Framework Home Page.

Beware !! TSP wave is coming...