EM-ODP  3.7.0
Event Machine on ODP
em_error.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INTERNAL_ERROR(error, escope, fmt, ...)
 
#define RETURN_ERROR_IF(cond, error, escope, fmt, ...)
 
#define EM_LOG(level, fmt, ...)
 
#define EM_VLOG(level, fmt, args)
 
#define EM_PRINT(fmt, ...)   EM_LOG(EM_LOG_PRINT, fmt, ## __VA_ARGS__)
 
#define EM_DBG(fmt, ...)
 

Functions

em_status_t internal_error (em_status_t error, em_escope_t escope,...)
 
em_status_t early_log_init (em_log_func_t user_log_fn, em_vlog_func_t user_vlog_fn)
 
void log_init (void)
 
void error_init (void)
 
em_status_t default_error_handler (em_eo_t eo, em_status_t error, em_escope_t escope, va_list args)
 
em_status_t select_error_handler (em_status_t error, em_escope_t escope, va_list args_list)
 
uint64_t load_global_err_cnt (void)
 
int default_log (em_log_level_t level, const char *fmt,...)
 
int vdefault_log (em_log_level_t level, const char *fmt, va_list args)
 

Detailed Description

Event Machine Error Handler functions

Definition in file em_error.h.

Macro Definition Documentation

◆ EM_DBG

#define EM_DBG (   fmt,
  ... 
)
Value:
do { \
if (EM_DEBUG_PRINT == 1) \
EM_LOG(EM_LOG_DBG, fmt, ##__VA_ARGS__); \
} while (0)

Definition at line 81 of file em_error.h.

◆ EM_LOG

#define EM_LOG (   level,
  fmt,
  ... 
)
Value:
do { \
em_log_func_t log_fn = em_locm.log_fn; \
if (log_fn) \
log_fn((level), fmt, ## __VA_ARGS__); \
else \
em_shm->log_fn((level), fmt, ## __VA_ARGS__); \
} while (0)

Definition at line 58 of file em_error.h.

◆ EM_VLOG

#define EM_VLOG (   level,
  fmt,
  args 
)
Value:
do { \
em_vlog_func_t vlog_fn = em_locm.vlog_fn; \
if (vlog_fn) \
vlog_fn((level), fmt, (args)); \
else \
em_shm->vlog_fn((level), fmt, (args)); \
} while (0)

Definition at line 67 of file em_error.h.

◆ INTERNAL_ERROR

#define INTERNAL_ERROR (   error,
  escope,
  fmt,
  ... 
)
Value:
internal_error((error), (escope), __FILE__, __func__, \
__LINE__, fmt, ## __VA_ARGS__)

Internal error reporting macro

Definition at line 43 of file em_error.h.

◆ RETURN_ERROR_IF

#define RETURN_ERROR_IF (   cond,
  error,
  escope,
  fmt,
  ... 
)
Value:
do { \
if (unlikely((cond))) { \
return INTERNAL_ERROR((error), (escope), \
fmt, ## __VA_ARGS__); \
} \
} while (0)

Internal macro for return on error

Definition at line 50 of file em_error.h.

Function Documentation

◆ default_error_handler()

em_status_t default_error_handler ( em_eo_t  eo,
em_status_t  error,
em_escope_t  escope,
va_list  args 
)

Default EM Error Handler

The default error handler is called upon error if the application(s) have not registered their own global and/or EO-specific error handlers

Parameters
eoEO reporting the error (if applicable)
errorThe error code (reason), see em_status_e
escopeThe error scope from within the error was reported, also tells whether the error was EM internal or application specific
argsva_list of args
Returns
The function may not return depending on implementation / error code / error scope. If it returns, the return value is the original (or modified) error code from the caller.

Definition at line 180 of file em_error.c.

◆ error_init()

void error_init ( void  )

Initialize the EM Error Handling

Definition at line 339 of file em_error.c.

◆ internal_error()

em_status_t internal_error ( em_status_t  error,
em_escope_t  escope,
  ... 
)

EM internal error Don't call directly, should always be used from within the error-macros

Called ONLY from INTERNAL_ERROR macro - do not use for anything else! internal_error((error), (escope), FILE, func, LINE, (format), ## VA_ARGS)

Definition at line 316 of file em_error.c.

◆ select_error_handler()

em_status_t select_error_handler ( em_status_t  error,
em_escope_t  escope,
va_list  args_list 
)

Select and call an error handler.

Parameters
errorError code
escopeError scope. Identifies the scope for interpreting the error code and variable arguments.
args_listVariable number and type of arguments
Returns
Returns the 'error' argument given as input if the called error handler has not changed this value.

Definition at line 250 of file em_error.c.

em_locm
ENV_LOCAL em_locm_t em_locm
internal_error
em_status_t internal_error(em_status_t error, em_escope_t escope,...)
Definition: em_error.c:316
em_locm_t::log_fn
em_log_func_t log_fn
Definition: em_mem.h:230
INTERNAL_ERROR
#define INTERNAL_ERROR(error, escope, fmt,...)
Definition: em_error.h:43
EM_DEBUG_PRINT
#define EM_DEBUG_PRINT
Definition: event_machine_config.h:292
em_locm_t::vlog_fn
em_vlog_func_t vlog_fn
Definition: em_mem.h:233