GPhoto2-Port-Log

GPhoto2-Port-Log —

Synopsis




enum        GPLogLevel;
void        (*GPLogFunc)                    (GPLogLevel level,
                                             const char *domain,
                                             const char *format,
                                             va_list args,
                                             void *data);
int         gp_log_add_func                 (GPLogLevel level,
                                             GPLogFunc func,
                                             void *data);
int         gp_log_remove_func              (int id);
void        gp_log                          (GPLogLevel level,
                                             const char *domain,
                                             const char *format,
                                             ...);
void        gp_logv                         (GPLogLevel level,
                                             const char *domain,
                                             const char *format,
                                             va_list args);
void        gp_log_data                     (const char *domain,
                                             const char *data,
                                             unsigned int size);
#define     GP_LOG                          (level, msg, params...)
#define     GP_DEBUG                        (msg, params...)

Description

Details

enum GPLogLevel

typedef enum {
	GP_LOG_ERROR = 0,
	GP_LOG_VERBOSE = 1,
	GP_LOG_DEBUG = 2,
	GP_LOG_DATA = 3
} GPLogLevel;


GPLogFunc ()

void        (*GPLogFunc)                    (GPLogLevel level,
                                             const char *domain,
                                             const char *format,
                                             va_list args,
                                             void *data);

level :
domain :
format :
args :
data :

gp_log_add_func ()

int         gp_log_add_func                 (GPLogLevel level,
                                             GPLogFunc func,
                                             void *data);

Adds a log function that will be called for each log message that is flagged with a log level that appears in given log level. This function returns an id that you can use for removing the log function again (using gp_log_remove_func).

level : a GPLogLevel
func : a GPLogFunc
data : data
Returns : an id or a gphoto2 error code

gp_log_remove_func ()

int         gp_log_remove_func              (int id);

Removes the log function with given id.

id : an id (return value of gp_log_add_func)
Returns : a gphoto2 error code

gp_log ()

void        gp_log                          (GPLogLevel level,
                                             const char *domain,
                                             const char *format,
                                             ...);

Logs a message at the given log level. You would normally use this function to log strings.

level : gphoto2 log level
domain : the domain
format : the format
... :

gp_logv ()

void        gp_logv                         (GPLogLevel level,
                                             const char *domain,
                                             const char *format,
                                             va_list args);

Logs a message at the given log level. You would normally use this function to log as yet unformatted strings.

level : gphoto2 log level
domain : the domain
format : the format
args : the va_list corresponding to format

gp_log_data ()

void        gp_log_data                     (const char *domain,
                                             const char *data,
                                             unsigned int size);

Takes the data and creates a formatted hexdump string. If you would like to log text messages, use gp_log instead.

domain : the domain
data : the data to be logged
size : the size of the data

GP_LOG()

#define     GP_LOG(level, msg, params...)

Calls gp_log with an automatically generated domain. You have to define GP_MODULE as "mymod" for your module mymod before you can use #GP_LOG().

level : gphoto2 log level to log message under
msg : message to log
params... :

GP_DEBUG()

#define     GP_DEBUG(msg, params...)

Logs message at log level GP_LOG_DEBUG by calling #gp_log() with an automatically generated domain You have to define GP_MODULE as "mymod" for your module mymod before using #GP_DEBUG().

msg : message to log
params... :