SimGrid  3.14.159
Versatile Simulation of Distributed Systems
log.h File Reference
#include "xbt/misc.h"
#include <stdarg.h>
#include <stddef.h>

Classes

struct  xbt_log_category_s
 
struct  xbt_log_event_s
 

Macros

#define XBT_LOG_STATIC_THRESHOLD   xbt_log_priority_none
 All logging requests with priority < XBT_LOG_STATIC_THRESHOLD are disabled at compile time, i.e., compiled out. More...
 
#define _XBT_LOGV(cat)   _XBT_LOG_CONCAT(_simgrid_log_category__, cat)
 
#define _XBT_LOGV_CTOR(cat)   _XBT_LOG_CONCAT2(_XBT_LOGV(cat), __constructor__)
 
#define _XBT_LOG_CONCAT(x, y)   x ## y
 
#define _XBT_LOG_CONCAT2(x, y)   _XBT_LOG_CONCAT(x, y)
 
#define _XBT_LOGV_CTOR_ATTRIBUTE   _XBT_GNUC_CONSTRUCTOR(600)
 
#define XBT_LOG_ROOT_CAT   root
 
#define XBT_LOG_CONNECT(cat)
 
#define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc)
 
#define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc)
 
#define XBT_LOG_NEW_CATEGORY(catName, desc)
 
#define XBT_LOG_DEFAULT_CATEGORY(cname)
 
#define XBT_LOG_NEW_DEFAULT_CATEGORY(cname, desc)
 
#define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc)
 
#define XBT_LOG_EXTERNAL_CATEGORY(cname)
 
#define XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(cname)
 
#define XBT_LOG_ISENABLED(catName, priority)
 
#define _XBT_LOG_ISENABLEDV(catv, priority)
 
#define XBT_CLOG(category, prio, ...)
 
#define XBT_LOG(prio, ...)
 
#define XBT_CDEBUG(categ, ...)
 Log an event at the DEBUG priority on the specified category with these args. More...
 
#define XBT_CVERB(categ, ...)
 Log an event at the VERB priority on the specified category with these args. More...
 
#define XBT_CINFO(categ, ...)
 Log an event at the INFO priority on the specified category with these args. More...
 
#define XBT_CWARN(categ, ...)
 Log an event at the WARN priority on the specified category with these args. More...
 
#define XBT_CERROR(categ, ...)
 Log an event at the ERROR priority on the specified category with these args. More...
 
#define XBT_CCRITICAL(categ, ...)
 Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10). More...
 
#define XBT_DEBUG(...)
 Log an event at the DEBUG priority on the default category with these args. More...
 
#define XBT_VERB(...)
 Log an event at the VERB priority on the default category with these args. More...
 
#define XBT_INFO(...)
 Log an event at the INFO priority on the default category with these args. More...
 
#define XBT_WARN(...)
 Log an event at the WARN priority on the default category with these args. More...
 
#define XBT_ERROR(...)
 Log an event at the ERROR priority on the default category with these args. More...
 
#define XBT_CRITICAL(...)
 Log an event at the CRITICAL priority on the default category with these args. More...
 
#define _XBT_IN_OUT(...)   _XBT_IF_ONE_ARG(_XBT_IN_OUT_ARG1, _XBT_IN_OUT_ARGN, __VA_ARGS__)(__VA_ARGS__)
 
#define _XBT_IN_OUT_ARG1(fmt)   XBT_LOG(xbt_log_priority_trace, fmt, __func__)
 
#define _XBT_IN_OUT_ARGN(fmt, ...)   XBT_LOG(xbt_log_priority_trace, fmt, __func__, __VA_ARGS__)
 
#define XBT_IN(...)
 Log at TRACE priority that we entered in current function, appending a user specified format. More...
 
#define XBT_OUT(...)
 Log at TRACE priority that we exited the current function, appending a user specified format. More...
 
#define XBT_HERE(...)
 Log at TRACE priority a message indicating that we reached that point, appending a user specified format. More...
 

Typedefs

typedef struct xbt_log_appender_s s_xbt_log_appender_t
 
typedef struct xbt_log_appender_sxbt_log_appender_t
 
typedef struct xbt_log_layout_s s_xbt_log_layout_t
 
typedef struct xbt_log_layout_sxbt_log_layout_t
 
typedef struct xbt_log_event_s s_xbt_log_event_t
 
typedef struct xbt_log_event_sxbt_log_event_t
 
typedef struct xbt_log_category_s s_xbt_log_category_t
 
typedef struct xbt_log_category_sxbt_log_category_t
 

Enumerations

enum  e_xbt_log_priority_t {
  xbt_log_priority_trace = 1, xbt_log_priority_debug = 2, xbt_log_priority_verbose = 3, xbt_log_priority_info = 4,
  xbt_log_priority_warning = 5, xbt_log_priority_error = 6, xbt_log_priority_critical = 7, xbt_log_priority_infinite = 8
}
 Log prioritiesThe different existing priorities. More...
 

Functions

void xbt_log_control_set (const char *cs)
 
void xbt_log_threshold_set (xbt_log_category_t cat, e_xbt_log_priority_t thresholdPriority)
 
void xbt_log_appender_set (xbt_log_category_t cat, xbt_log_appender_t app)
 
void xbt_log_layout_set (xbt_log_category_t cat, xbt_log_layout_t lay)
 
void xbt_log_additivity_set (xbt_log_category_t cat, int additivity)
 
xbt_log_layout_t xbt_log_layout_simple_new (char *arg)
 create a new simple layout More...
 
xbt_log_layout_t xbt_log_layout_format_new (char *arg)
 
xbt_log_appender_t xbt_log_appender_file_new (char *arg)
 
xbt_log_appender_t xbt_log_appender2_file_new (char *arg, int roll)
 
void _xbt_log_event_log (xbt_log_event_t ev, const char *fmt,...) XBT_ATTRIB_PRINTF(2
 
void int _xbt_log_cat_init (xbt_log_category_t category, e_xbt_log_priority_t priority)
 
s_xbt_log_category_t _XBT_LOGV (XBT_LOG_ROOT_CAT)
 

Variables

xbt_log_appender_t xbt_log_default_appender
 
xbt_log_layout_t xbt_log_default_layout
 

Macro Definition Documentation

§ _XBT_LOGV

#define _XBT_LOGV (   cat)    _XBT_LOG_CONCAT(_simgrid_log_category__, cat)

§ _XBT_LOGV_CTOR

#define _XBT_LOGV_CTOR (   cat)    _XBT_LOG_CONCAT2(_XBT_LOGV(cat), __constructor__)

§ _XBT_LOG_CONCAT

#define _XBT_LOG_CONCAT (   x,
 
)    x ## y

§ _XBT_LOG_CONCAT2

#define _XBT_LOG_CONCAT2 (   x,
 
)    _XBT_LOG_CONCAT(x, y)

§ _XBT_LOGV_CTOR_ATTRIBUTE

#define _XBT_LOGV_CTOR_ATTRIBUTE   _XBT_GNUC_CONSTRUCTOR(600)

§ XBT_LOG_ROOT_CAT

#define XBT_LOG_ROOT_CAT   root

§ XBT_LOG_CONNECT

#define XBT_LOG_CONNECT (   cat)
Value:
if (1) { \
extern void _XBT_LOGV_CTOR(cat)(void); \
_XBT_LOGV_CTOR(cat)(); \
} else ((void)0)
void
Definition: smpi_mpi.cpp:35
#define _XBT_LOGV_CTOR(cat)
Definition: log.h:86

§ XBT_LOG_NEW_SUBCATEGORY_helper

#define XBT_LOG_NEW_SUBCATEGORY_helper (   catName,
  parent,
  desc 
)
Value:
extern void _XBT_LOGV_CTOR(catName)(void) _XBT_LOGV_CTOR_ATTRIBUTE; \
void _XBT_LOGV_CTOR(catName)(void) \
{ \
XBT_LOG_EXTERNAL_CATEGORY(catName); \
if (!_XBT_LOGV(catName).initialized) { \
_xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized); \
} \
} \
SG_END_DECL() \
XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \
&_XBT_LOGV(parent), \
NULL /* firstChild */, \
NULL /* nextSibling */, \
#catName, \
desc, \
0 /*initialized */, \
xbt_log_priority_uninitialized /* threshold */, \
1 /* isThreshInherited */, \
NULL /* appender */, \
NULL /* layout */, \
1 /* additivity */ \
}
#define _XBT_LOGV_CTOR_ATTRIBUTE
Definition: log.h:93
Definition: log.h:251
void
Definition: smpi_mpi.cpp:35
SG_BEGIN_DECL()
#define _XBT_LOGV(cat)
Definition: log.h:85
#define _XBT_LOGV_CTOR(cat)
Definition: log.h:86

§ _XBT_LOG_ISENABLEDV

#define _XBT_LOG_ISENABLEDV (   catv,
  priority 
)
Value:
&& ((catv).initialized || _xbt_log_cat_init(&(catv), priority)) \
&& priority >= (catv).threshold)
#define XBT_LOG_STATIC_THRESHOLD
All logging requests with priority < XBT_LOG_STATIC_THRESHOLD are disabled at compile time...
Definition: log.h:79
void int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority)
Definition: log.c:450

§ XBT_CLOG

#define XBT_CLOG (   category,
  prio,
  ... 
)
Value:
do { \
if (_XBT_LOG_ISENABLEDV((category), prio)) { \
s_xbt_log_event_t _log_ev; \
_log_ev.cat = &(category); \
_log_ev.priority = (prio); \
_log_ev.fileName = __FILE__; \
_log_ev.functionName = __func__; \
_log_ev.lineNum = __LINE__; \
_xbt_log_event_log(&_log_ev, __VA_ARGS__); \
} \
} while (0)
#define _XBT_LOG_ISENABLEDV(catv, priority)
Definition: log.h:364

§ XBT_LOG

#define XBT_LOG (   prio,
  ... 
)
Value:
do { \
if (_XBT_LOG_ISENABLEDV((*_simgrid_log_category__default), prio)) { \
s_xbt_log_event_t _log_ev; \
_log_ev.cat = _simgrid_log_category__default; \
_log_ev.priority = (prio); \
_log_ev.fileName = __FILE__; \
_log_ev.functionName = __func__; \
_log_ev.lineNum = __LINE__; \
_xbt_log_event_log(&_log_ev, __VA_ARGS__); \
} \
} while (0)
#define _XBT_LOG_ISENABLEDV(catv, priority)
Definition: log.h:364

§ _XBT_IN_OUT

#define _XBT_IN_OUT (   ...)    _XBT_IF_ONE_ARG(_XBT_IN_OUT_ARG1, _XBT_IN_OUT_ARGN, __VA_ARGS__)(__VA_ARGS__)

§ _XBT_IN_OUT_ARG1

#define _XBT_IN_OUT_ARG1 (   fmt)    XBT_LOG(xbt_log_priority_trace, fmt, __func__)

§ _XBT_IN_OUT_ARGN

#define _XBT_IN_OUT_ARGN (   fmt,
  ... 
)    XBT_LOG(xbt_log_priority_trace, fmt, __func__, __VA_ARGS__)

Typedef Documentation

§ s_xbt_log_appender_t

§ xbt_log_appender_t

§ s_xbt_log_layout_t

§ xbt_log_layout_t

§ s_xbt_log_event_t

§ xbt_log_event_t

§ s_xbt_log_category_t

§ xbt_log_category_t

Function Documentation

§ xbt_log_threshold_set()

void xbt_log_threshold_set ( xbt_log_category_t  cat,
e_xbt_log_priority_t  thresholdPriority 
)
Parameters
catthe category (not only its name, but the variable)
thresholdPrioritythe priority

Programatically alters a category's threshold priority (don't use).

§ xbt_log_appender_set()

void xbt_log_appender_set ( xbt_log_category_t  cat,
xbt_log_appender_t  app 
)
Parameters
catthe category (not only its name, but the variable)
appthe appender

Programatically sets the category's appender. (the preferred interface is through xbt_log_control_set())

§ xbt_log_layout_set()

void xbt_log_layout_set ( xbt_log_category_t  cat,
xbt_log_layout_t  lay 
)
Parameters
catthe category (not only its name, but the variable)
laythe layout

Programatically sets the category's layout. (the preferred interface is through xbt_log_control_set())

§ xbt_log_additivity_set()

void xbt_log_additivity_set ( xbt_log_category_t  cat,
int  additivity 
)
Parameters
catthe category (not only its name, but the variable)
additivitywhether logging actions must be passed to parent.

Programatically sets whether the logging actions must be passed to the parent category. (the preferred interface is through xbt_log_control_set())

§ xbt_log_layout_simple_new()

xbt_log_layout_t xbt_log_layout_simple_new ( char *  arg)

create a new simple layout

This layout is not as flexible as the pattern one

§ xbt_log_layout_format_new()

xbt_log_layout_t xbt_log_layout_format_new ( char *  arg)

§ xbt_log_appender_file_new()

xbt_log_appender_t xbt_log_appender_file_new ( char *  arg)

§ xbt_log_appender2_file_new()

xbt_log_appender_t xbt_log_appender2_file_new ( char *  arg,
int  roll 
)

§ _xbt_log_event_log()

void _xbt_log_event_log ( xbt_log_event_t  ev,
const char *  fmt,
  ... 
)

§ _xbt_log_cat_init()

void int _xbt_log_cat_init ( xbt_log_category_t  category,
e_xbt_log_priority_t  priority 
)

§ _XBT_LOGV()

Variable Documentation

§ xbt_log_default_appender

xbt_log_appender_t xbt_log_default_appender

§ xbt_log_default_layout

xbt_log_layout_t xbt_log_default_layout