X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a171cbe40cc9c3e1a5f30ec8fc74c6e4207f4db4..fb2c06ad23be8a12b22bdc8e77c63f4d7c61a1bb:/include/xbt/log.h diff --git a/include/xbt/log.h b/include/xbt/log.h index bda65077ad..5a0df31b4b 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -28,13 +28,12 @@ /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic printf function. Useful to debug the logging facilities themselves */ #undef XBT_LOG_MAYDAY -/*#define XBT_LOG_MAYDAY*/ +//#define XBT_LOG_MAYDAY #ifndef _XBT_LOG_H_ #define _XBT_LOG_H_ #include "xbt/misc.h" - #include SG_BEGIN_DECL() /**\brief Log priorities @@ -42,20 +41,20 @@ SG_BEGIN_DECL() * * The different existing priorities. */ - typedef enum { - xbt_log_priority_none = 0, /* used internally (don't poke with) */ - xbt_log_priority_trace = 1, /**< enter and return of some functions */ - xbt_log_priority_debug = 2, /**< crufty output */ - xbt_log_priority_verbose = 3, /**< verbose output for the user wanting more */ - xbt_log_priority_info = 4, /**< output about the regular functionning */ - xbt_log_priority_warning = 5, /**< minor issue encountered */ - xbt_log_priority_error = 6, /**< issue encountered */ - xbt_log_priority_critical = 7, /**< major issue encountered */ +typedef enum { + xbt_log_priority_none = 0, /* used internally (don't poke with) */ + xbt_log_priority_trace = 1, /**< enter and return of some functions */ + xbt_log_priority_debug = 2, /**< crufty output */ + xbt_log_priority_verbose = 3, /**< verbose output for the user wanting more */ + xbt_log_priority_info = 4, /**< output about the regular functionning */ + xbt_log_priority_warning = 5, /**< minor issue encountered */ + xbt_log_priority_error = 6, /**< issue encountered */ + xbt_log_priority_critical = 7, /**< major issue encountered */ - xbt_log_priority_infinite = 8, /**< value for XBT_LOG_STATIC_THRESHOLD to not log */ + xbt_log_priority_infinite = 8, /**< value for XBT_LOG_STATIC_THRESHOLD to not log */ - xbt_log_priority_uninitialized = -1 /* used internally (don't poke with) */ - } e_xbt_log_priority_t; + xbt_log_priority_uninitialized = -1 /* used internally (don't poke with) */ +} e_xbt_log_priority_t; /* @@ -77,13 +76,13 @@ SG_BEGIN_DECL() # ifdef NDEBUG # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose -# else /* !NLOG && !NDEBUG */ +# else /* !NLOG && !NDEBUG */ # ifndef XBT_LOG_STATIC_THRESHOLD # define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none -# endif /* !XBT_LOG_STATIC_THRESHOLD */ -# endif /* NDEBUG */ -#endif /* !defined(NLOG) */ +# endif /* !XBT_LOG_STATIC_THRESHOLD */ +# endif /* NDEBUG */ +#endif /* !defined(NLOG) */ /* Transforms a category name to a global variable name. */ #define _XBT_LOGV(cat) _XBT_LOG_CONCAT(_simgrid_log_category__, cat) @@ -169,7 +168,7 @@ SG_BEGIN_DECL() * Indicates which category is the default one. */ -#if defined(XBT_LOG_MAYDAY) || defined(SUPERNOVAE_MODE) /*|| defined (NLOG) * turning logging off */ +#if defined(XBT_LOG_MAYDAY) || defined(SUPERNOVAE_MODE) /*|| defined (NLOG) * turning logging off */ # define XBT_LOG_DEFAULT_CATEGORY(cname) #else # define XBT_LOG_DEFAULT_CATEGORY(cname) \ @@ -232,12 +231,12 @@ SG_BEGIN_DECL() XBT_PUBLIC(void) xbt_log_control_set(const char *cs); /* Forward declarations */ - typedef struct xbt_log_appender_s s_xbt_log_appender_t, - *xbt_log_appender_t; - typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t; - typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t; - typedef struct xbt_log_category_s s_xbt_log_category_t, - *xbt_log_category_t; +typedef struct xbt_log_appender_s s_xbt_log_appender_t, + *xbt_log_appender_t; +typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t; +typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t; +typedef struct xbt_log_category_s s_xbt_log_category_t, + *xbt_log_category_t; /* * Do NOT access any members of this structure directly. FIXME: move to private? @@ -247,32 +246,32 @@ XBT_PUBLIC(void) xbt_log_control_set(const char *cs); #else #define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */ #endif - struct xbt_log_category_s { - xbt_log_category_t parent; - xbt_log_category_t firstChild; - xbt_log_category_t nextSibling; - const char *name; - int threshold; - int isThreshInherited; - xbt_log_appender_t appender; - xbt_log_layout_t layout; - int additivity; - }; - - struct xbt_log_event_s { - xbt_log_category_t cat; - e_xbt_log_priority_t priority; - const char *fileName; - const char *functionName; - int lineNum; - va_list ap; - va_list ap_copy; /* need a copy to launch dynamic layouts when the static ones overflowed */ +struct xbt_log_category_s { + xbt_log_category_t parent; + xbt_log_category_t firstChild; + xbt_log_category_t nextSibling; + const char *name; + int threshold; + int isThreshInherited; + xbt_log_appender_t appender; + xbt_log_layout_t layout; + int additivity; +}; + +struct xbt_log_event_s { + xbt_log_category_t cat; + e_xbt_log_priority_t priority; + const char *fileName; + const char *functionName; + int lineNum; + va_list ap; + va_list ap_copy; /* need a copy to launch dynamic layouts when the static ones overflowed */ #ifdef _XBT_WIN32 - char *buffer; + char *buffer; #else - char buffer[XBT_LOG_BUFF_SIZE]; + char buffer[XBT_LOG_BUFF_SIZE]; #endif - }; +}; /** * \ingroup XBT_log_implem @@ -344,8 +343,8 @@ XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category, XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); - extern xbt_log_appender_t xbt_log_default_appender; - extern xbt_log_layout_t xbt_log_default_layout; +extern xbt_log_appender_t xbt_log_default_appender; +extern xbt_log_layout_t xbt_log_default_layout; /* ********************** */ /* Public functions again */ @@ -391,6 +390,7 @@ XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); * Setting the LogEvent's valist member is done inside _log_logEvent. */ #ifdef _XBT_WIN32 +#include /* calloc */ #define _XBT_LOG_PRE(catv, prio) do { \ if (_XBT_LOG_ISENABLEDV(catv, prio)) { \ s_xbt_log_event_t _log_ev; \ @@ -402,6 +402,7 @@ XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char)); \ _xbt_log_event_log(&_log_ev #else +#include /* memset */ #define _XBT_LOG_PRE(catv, prio) do { \ if (_XBT_LOG_ISENABLEDV(catv, prio)) { \ s_xbt_log_event_t _log_ev; \ @@ -703,6 +704,7 @@ XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); * @brief Log at TRACE priority that we entered in current function, appending a user specified format taking 5 args (XBT_INn exists for all n in [1,6]) */ #define XBT_IN5(fmt,a,b,c,d,e) LOG6(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d,e) +#define XBT_IN6(fmt,a,b,c,d,e,f) LOG7(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d,e,f) /** @ingroup XBT_log * @hideinitializer * @brief Log at TRACE priority that we exited the current function. @@ -716,4 +718,4 @@ XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); SG_END_DECL() -#endif /* ! _XBT_LOG_H_ */ +#endif /* ! _XBT_LOG_H_ */