16 #ifndef JM_CALLBACKS_H 17 #define JM_CALLBACKS_H 71 #define JM_MAX_ERROR_MESSAGE_SIZE 2000 191 #ifdef FMILIB_ENABLE_LOG_LEVEL_DEBUG FMILIB_EXPORT void jm_log_info_v(jm_callbacks *cb, const char *module, const char *fmt, va_list ap)
Send an info message to the logger function. See jm_log() for details.
jm_calloc_f calloc
Allocate zero initialized memory.
Library configuration file generated by the build system.
FMILIB_EXPORT void jm_log_warning_v(jm_callbacks *cb, const char *module, const char *fmt, va_list ap)
Send a warning message to the logger function. See jm_log() for details.
FMILIB_EXPORT jm_callbacks * jm_get_default_callbacks(void)
Get default callbacks. The function never returns NULL.
void * jm_voidp
A void pointer.
jm_voidp(* jm_realloc_f)(void *ptr, size_t size)
Re-allocation function type.
static void jm_clear_last_error(jm_callbacks *cb)
Clear the last generated log message.
static void jm_log_debug_v(jm_callbacks *cb, const char *module, const char *fmt, va_list ap)
Send a debug message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_log_v(jm_callbacks *cb, const char *module, jm_log_level_enu_t log_level, const char *fmt, va_list ap)
Send a message to the logger function.
char errMessageBuffer[JM_MAX_ERROR_MESSAGE_SIZE]
The buffer used along with jm_get_last_error()
FMILIB_EXPORT void jm_log(jm_callbacks *cb, const char *module, jm_log_level_enu_t log_level, const char *fmt,...)
Send a message to the logger function.
jm_voidp(* jm_calloc_f)(size_t numitems, size_t itemsize)
Zero-initialized allocation function type.
jm_log_level_enu_t
Log levels supported via the logger functions in jm_callbacks.
jm_log_level_enu_t log_level
Logging level.
FMILIB_EXPORT void jm_log_fatal_v(jm_callbacks *cb, const char *module, const char *fmt, va_list ap)
Send a fatal error message to the logger function. See jm_log() for details.
#define FMILIB_EXPORT
Used to declare the public API of the library needed for dynamic linking.
static jm_string jm_get_last_error(jm_callbacks *cb)
Get the last log message produced by the library.
FMILIB_EXPORT void jm_log_warning(jm_callbacks *cb, const char *module, const char *fmt,...)
Send a warning message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_set_default_callbacks(jm_callbacks *c)
Set the structure to be returned by jm_get_default_callbacks().
FMILIB_EXPORT void jm_log_fatal(jm_callbacks *cb, const char *module, const char *fmt,...)
Send a fatal error message to the logger function. See jm_log() for details.
jm_voidp(* jm_malloc_f)(size_t size)
Allocation function type.
FMILIB_EXPORT void jm_log_error_v(jm_callbacks *cb, const char *module, const char *fmt, va_list ap)
Send a error message to the logger function. See jm_log() for details.
jm_malloc_f malloc
Allocate non-initialized memory.
jm_voidp context
Arbitrary context pointer passed to the logger function.
const char * jm_string
A constant string.
FMILIB_EXPORT void jm_log_info(jm_callbacks *cb, const char *module, const char *fmt,...)
Send an info message to the logger function. See jm_log() for details.
FMILIB_EXPORT void jm_default_logger(jm_callbacks *c, jm_string module, jm_log_level_enu_t log_level, jm_string message)
The default logger implementation prints messages to stderr.
The callbacks struct is sent to all the modules in the library.
void(* jm_logger_f)(jm_callbacks *c, jm_string module, jm_log_level_enu_t log_level, jm_string message)
Logger callback type.
FMILIB_EXPORT void jm_log_verbose_v(jm_callbacks *cb, const char *module, const char *fmt, va_list ap)
Send a verbose message to the logger function. See jm_log() for details.
#define JM_MAX_ERROR_MESSAGE_SIZE
Maximum message size that can be stored in the jm_callbacks struct.
jm_realloc_f realloc
Re-allocate memory.
jm_free_f free
Free-allocated memory.
FMILIB_EXPORT void jm_log_verbose(jm_callbacks *cb, const char *module, const char *fmt,...)
Send a verbose message to the logger function. See jm_log() for details.
jm_logger_f logger
Logging callback.
FMILIB_EXPORT void jm_log_error(jm_callbacks *cb, const char *module, const char *fmt,...)
Send a error message to the logger function. See jm_log() for details.
static void jm_log_debug(jm_callbacks *cb, const char *module, const char *fmt,...)
Send a debug message to the logger function. See jm_log() for details.
void(* jm_free_f)(jm_voidp p)
Free memory function type.