X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f2c8100157073c9fa6be8ab93d723432fef5c5c7..60f31f9d24bd348ccad2ea99ba96424360b11a92:/include/gras/log.h diff --git a/include/gras/log.h b/include/gras/log.h index 04996099d6..585c05fc3e 100644 --- a/include/gras/log.h +++ b/include/gras/log.h @@ -35,29 +35,41 @@ */ typedef enum { gras_log_priority_none = 0, - gras_log_priority_debug = 1, - gras_log_priority_verbose = 2, - gras_log_priority_info = 3, - gras_log_priority_warning = 4, - gras_log_priority_error = 5, - gras_log_priority_critical = 6, + gras_log_priority_trace = 1, + gras_log_priority_debug = 2, + gras_log_priority_verbose = 3, + gras_log_priority_info = 4, + gras_log_priority_warning = 5, + gras_log_priority_error = 6, + gras_log_priority_critical = 7, - gras_log_priority_infinite = 7, + gras_log_priority_infinite = 8, gras_log_priority_uninitialized = -1 } gras_log_priority_t; +/** + * NLOG: + * + * All logging facilities are disabled at compilation time + */ + + /** * GRAS_LOG_STATIC_THRESHOLD: * * All logging with priority < GRAS_LOG_STATIC_THRESHOLD is disabled at * compile time, i.e., compiled out. */ +#ifdef NLOG +# define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_infinite +#else + #ifndef GRAS_LOG_STATIC_THRESHOLD # define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_none -#endif - +#endif +#endif /* !defined(NLOG) */ /* Transforms a category name to a global variable name. */ #define _GRAS_LOGV(cat) _GRAS_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat) @@ -73,6 +85,7 @@ typedef enum { * * Defines a new subcategory of the parent. */ +//#ifndef NLOG #define GRAS_LOG_NEW_SUBCATEGORY(catName, parent) \ extern gras_log_category_t _GRAS_LOGV(parent); \ gras_log_category_t _GRAS_LOGV(catName) = { \ @@ -80,6 +93,9 @@ typedef enum { #catName, gras_log_priority_uninitialized, 1, \ 0, 1 \ }; +//#else /* No logging at all, please */ +//#define GRAS_LOG_NEW_SUBCATEGORY(catName,parent) +//#endif /** * GRAS_LOG_NEW_CATEGORY: @@ -96,7 +112,7 @@ typedef enum { * Indicates which category is the default one. */ -#ifdef GRAS_LOG_MAYDAY /* debuging the logs themselves */ +#if defined(GRAS_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */ # define GRAS_LOG_DEFAULT_CATEGORY(cname) #else # define GRAS_LOG_DEFAULT_CATEGORY(cname) \ @@ -538,7 +554,21 @@ extern gras_log_appender_t *gras_log_default_appender; #define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5) #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6) -#define GRAS_IN DEBUG0(">> begin of function") -#define GRAS_OUT DEBUG0("<< end of function") +#ifdef __GNUC__ +#define GRAS_IN LOG1(gras_log_priority_trace, ">> begin of %s", __FUNCTION__) +#define GRAS_IN1(fmt,a) LOG2(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a) +#define GRAS_IN2(fmt,a,b) LOG3(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b) +#define GRAS_IN3(fmt,a,b,c) LOG4(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b,c) +#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b,c,d) +#define GRAS_OUT LOG1(gras_log_priority_trace, "<< end of %s", __FUNCTION__) +#else /* if fool enough to compile without gcc */ +#define GRAS_IN LOG0(gras_log_priority_trace, ">> begin of function") +#define GRAS_IN1(fmt,a) LOG2(gras_log_priority_trace, ">> begin of function " fmt, a) +#define GRAS_IN2(fmt,a,b) LOG3(gras_log_priority_trace, ">> begin of function " fmt, a,b) +#define GRAS_IN3(fmt,a,b,c) LOG4(gras_log_priority_trace, ">> begin of function " fmt, a,b,c) +#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of function " fmt, a,b,c,d) + +#define GRAS_OUT(fmt,a) LOG0(gras_log_priority_trace, "<< end of function") +#endif /* end of foolness for non-gcc */ #endif /* ! _GRAS_LOG_H_ */