C-Pluff C API  0.2.0
Functions
Logging

These functions can be used to receive and emit log messages related to a particular plug-in context. More...

Functions

CP_IMPORT cp_status_t cp_register_logger (cp_context_t *ctx, cp_logger_func_t logger, void *user_data, cp_log_severity_t min_severity)
 Registers a logger with a plug-in context or updates the settings of a registered logger. More...
 
CP_IMPORT void cp_unregister_logger (cp_context_t *ctx, cp_logger_func_t logger)
 Removes a logger registration. More...
 
CP_IMPORT void cp_log (cp_context_t *ctx, cp_log_severity_t severity, const char *msg)
 Emits a new log message. More...
 
CP_IMPORT int cp_is_logged (cp_context_t *ctx, cp_log_severity_t severity)
 Returns whether a message of the specified severity would get logged. More...
 

Detailed Description

These functions can be used to receive and emit log messages related to a particular plug-in context.

They can be used by the main program or by a plug-in runtime.

Function Documentation

◆ cp_register_logger()

CP_IMPORT cp_status_t cp_register_logger ( cp_context_t ctx,
cp_logger_func_t  logger,
void *  user_data,
cp_log_severity_t  min_severity 
)

Registers a logger with a plug-in context or updates the settings of a registered logger.

The logger will receive selected log messages. If the specified logger is not yet known, a new logger registration is made, otherwise the settings for the existing logger are updated. The logger can be unregistered using cp_unregister_logger and it is automatically unregistered when the registering plug-in is stopped or when the context is destroyed.

Parameters
ctxthe plug-in context to log
loggerthe logger function to be called
user_datathe user data pointer passed to the logger
min_severitythe minimum severity of messages passed to logger
Returns
CP_OK (zero) on success or CP_ERR_RESOURCE if insufficient memory

◆ cp_unregister_logger()

CP_IMPORT void cp_unregister_logger ( cp_context_t ctx,
cp_logger_func_t  logger 
)

Removes a logger registration.

Parameters
ctxthe plug-in context
loggerthe logger function to be unregistered

◆ cp_log()

CP_IMPORT void cp_log ( cp_context_t ctx,
cp_log_severity_t  severity,
const char *  msg 
)

Emits a new log message.

Parameters
ctxthe plug-in context
severitythe severity of the event
msgthe log message (possibly localized)

◆ cp_is_logged()

CP_IMPORT int cp_is_logged ( cp_context_t ctx,
cp_log_severity_t  severity 
)

Returns whether a message of the specified severity would get logged.

Parameters
ctxthe plug-in context
severitythe target logging severity
Returns
whether a message of the specified severity would get logged

Generated on Fri May 1 2020 01:06:58 for C-Pluff C API by doxygen 1.8.13