SimGrid  3.16
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_init (int *argc, char **argv)
 Get all logging settings from the command line. More...
 
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:36
#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) = { \
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
int int errorclass int flag void baseptr void int MPI_Datatype void int int MPI_Datatype int MPI_Comm comm MPI_Status MPI_Datatype int count char int resultlen void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Win win void void MPI_Datatype int MPI_Aint MPI_Op MPI_Win win MPI_Group MPI_Group MPI_Group newgroup MPI_Group group MPI_Group MPI_Group MPI_Group newgroup MPI_Group int int MPI_Group newgroup MPI_Group int size MPI_Group MPI_Group MPI_Group newgroup MPI_Info char key MPI_Info info MPI_Info int nkeys MPI_Info char int int flag int flag int char int int provided void int MPI_Datatype int int MPI_Comm MPI_Request request void int MPI_Datatype int int MPI_Comm MPI_Request request MPI_Copy_function MPI_Delete_function int void extra_state MPI_User_function int MPI_Op op MPI_Op int commute void int MPI_Datatype void int int MPI_Comm comm void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Win win void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Op MPI_Win MPI_Request request void int MPI_Datatype int int MPI_Comm MPI_Status status void void int MPI_Datatype MPI_Op MPI_Comm comm void void int MPI_Datatype MPI_Op int MPI_Comm comm void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Win MPI_Request request void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Win MPI_Request request void int MPI_Datatype void int MPI_Datatype int MPI_Comm comm void int MPI_Datatype int int MPI_Comm MPI_Request request void int MPI_Datatype int int void int MPI_Datatype int int MPI_Comm MPI_Status status void int MPI_Datatype int int MPI_Comm MPI_Request request int MPI_Request requests int MPI_Request int MPI_Status statuses MPI_Request int MPI_Status status MPI_Datatype datatype int int MPI_Aint MPI_Datatype MPI_Datatype newtype int int MPI_Aint MPI_Datatype MPI_Datatype new_type int int int MPI_Datatype MPI_Datatype newtype MPI_Datatype MPI_Aint MPI_Aint MPI_Datatype newtype MPI_Datatype int type_keyval MPI_Datatype MPI_Aint extent MPI_Datatype datatype MPI_Datatype MPI_Aint MPI_Aint extent MPI_Datatype MPI_Aint MPI_Aint extent int int MPI_Aint MPI_Datatype MPI_Datatype newtype MPI_Datatype MPI_Aint disp MPI_Datatype char name MPI_Datatype MPI_Count size MPI_Datatype MPI_Aint disp void int int void int MPI_Datatype MPI_Comm comm int MPI_Request int MPI_Status status int MPI_Request int int MPI_Status status void MPI_Aint int MPI_Info MPI_Comm MPI_Win win MPI_Win void MPI_Aint size MPI_Info MPI_Comm MPI_Win win MPI_Win win MPI_Win char int len MPI_Group int MPI_Win win MPI_Win MPI_Info info MPI_Win win int MPI_Win win MPI_Win win int MPI_Win win MPI_Win win MPI_Win int void att MPI_Win_copy_attr_function MPI_Win_delete_attr_function int void extra_state MPI_Fint comm MPI_Comm comm MPI_Info info MPI_Request request MPI_Win win MPI_Fint info MPI_Fint request int errorclass int char string void int MPI_Datatype int int MPI_Comm MPI_Request request void int size MPI_Request request char port_name MPI_Comm int errorcode MPI_Comm_errhandler_fn MPI_Errhandler errhandler MPI_Comm MPI_Errhandler errhandler MPI_Comm * parent
Definition: smpi_mpi.cpp:263
Definition: log.h:251
void
Definition: smpi_mpi.cpp:36
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:445

◆ 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:365

◆ 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:365

◆ _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_init()

void xbt_log_init ( int *  argc,
char **  argv 
)

Get all logging settings from the command line.

xbt_log_control_set() is called on each string we got from cmd line

◆ _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