l4log.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __LOG_INCLUDE_L4LOG_H_
00014 #define __LOG_INCLUDE_L4LOG_H_
00015
00016 #include <l4/sys/compiler.h>
00017
00018 EXTERN_C_BEGIN
00019
00020 #include <l4/log/log_printf.h>
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 extern char LOG_tag[9];
00036
00037 #if 0
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 extern void LOG_init(const char *tag);
00048 #else
00049 #define LOG_init(arg) LOG_init_is_deprecated=0
00050
00051 L4_CV void LOG_setup_tag(void);
00052 #endif
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 extern L4_CV void (*LOG_outstring)(const char*log_message);
00063
00064
00065
00066
00067
00068
00069 L4_CV void LOG_outstring_fiasco_tbuf(const char*log_message);
00070
00071
00072
00073
00074
00075
00076 L4_CV void LOG_flush(void);
00077
00078
00079
00080 #ifdef DEBUG
00081 #define LOG_DEBUG 1
00082 #else
00083 #define LOG_DEBUG 0
00084 #endif
00085
00086 L4_CV void LOG_log(const char*function, const char*format,...);
00087 L4_CV void LOG_logl(const char*file, int line, const char*function,
00088 const char*format,...);
00089 L4_CV void LOG_logL(const char*file, int line, const char*function,
00090 const char*format,...);
00091
00092 #ifndef L4BID_RELEASE_MODE
00093
00094 L4_CV void LOG_format_check(const char*format,...)
00095 __attribute__((format(printf,1,2)));
00096
00097 #define STRINGIFY_HELPER(nr) #nr
00098 #define LINE_PRESCAN_SUBST(ln) STRINGIFY_HELPER(ln)
00099 #define __LINE_STR__ LINE_PRESCAN_SUBST(__LINE__)
00100
00101 #define LOG(a...) do { \
00102 if(0)LOG_format_check(a); \
00103 LOG_log(__FUNCTION__, a); \
00104 } while(0)
00105
00106 #define LOGl(a...) do { \
00107 if(0)LOG_format_check(a); \
00108 LOG_logl(__FILE__,__LINE__,__FUNCTION__, a); \
00109 } while(0)
00110
00111 #define LOGL(a...) do { \
00112 if(0)LOG_format_check(a); \
00113 LOG_logL(__FILE__,__LINE__,__FUNCTION__, a); \
00114 } while(0)
00115
00116 #define LOG_Enter(a...) do { \
00117 if(0)LOG_format_check("called "a); \
00118 LOG_log(__FUNCTION__, "called "a); \
00119 } while(0)
00120
00121 #define LOGk(a...) do { \
00122 if(0)LOG_format_check(a); \
00123 LOG_logk(a); \
00124 } while(0)
00125
00126 #define LOGd_Enter(doit, msg...) do { if(doit) LOG_Enter(msg); } while (0)
00127 #define LOGd(doit, msg...) do { if(doit) LOG(msg); } while (0)
00128 #define LOGdl(doit,msg...) do { if(doit) LOGl(msg); } while (0)
00129 #define LOGdL(doit,msg...) do { if(doit) LOGL(msg); } while (0)
00130 #define LOGdk(doit,msg...) do { if(doit) LOGk(msg); } while (0)
00131 #define LOG_Error(msg...) LOGL("Error: " msg)
00132
00133 #define LOG_logk(format...) do { \
00134 char buf[35]; \
00135 LOG_snprintf(buf,sizeof(buf),format); \
00136 LOG_outstring_fiasco_tbuf(buf); \
00137 } while (0)
00138
00139 #else
00140 #define LOG(a...)
00141 #define LOGl(a...)
00142 #define LOGL(a...)
00143 #define LOGk(a...)
00144 #define LOG_Enter(a...)
00145 #define LOGd_Enter(doit, msg...)
00146 #define LOGd(doit, msg...)
00147 #define LOGdl(doit,msg...)
00148 #define LOGdL(doit,msg...)
00149 #define LOGdk(doit,msg...)
00150 #define LOG_Error(msg...)
00151 #endif
00152
00153 EXTERN_C_END
00154 #endif