21 #ifndef __GPHOTO2_PORT_LOG_H__
22 #define __GPHOTO2_PORT_LOG_H__
46 #define GP_LOG_ALL GP_LOG_DATA
63 #ifndef DISABLE_DEBUGGING
70 const char *format, ...)
72 __attribute__((__format__(printf,3,4)))
78 __attribute__((__format__(printf,3,0)))
81 void gp_log_data (
const char *domain,
const char *data,
unsigned int size);
95 #ifdef _GPHOTO2_INTERNAL_CODE
96 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
97 #define GP_DEBUG(...) \
98 gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, __VA_ARGS__)
99 #elif defined(__GNUC__) && __GNUC__ >= 2
100 #define GP_DEBUG(msg, params...) \
101 gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, msg, ##params)
104 # warning Disabling GP_DEBUG because variadic macros are not allowed
106 #define GP_DEBUG (void)
113 #define gp_log_add_func(level, func, data) (0)
114 #define gp_log_remove_func(id) (0)
115 #define gp_log(level, domain, format, args...)
116 #define gp_logv(level, domain, format, args)
117 #define gp_log_data(domain, data, size)
119 #ifdef _GPHOTO2_INTERNAL_CODE
120 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
121 #define GP_DEBUG(...)
122 #elif defined(__GNUC__)
123 #define GP_DEBUG(msg, params...)
125 #define GP_DEBUG (void)
131 #ifdef _GPHOTO2_INTERNAL_CODE
133 typedef struct StringFlagItem {
138 typedef void (*string_item_func) (
const char *str,
void *data);
141 gpi_enum_to_string(
const unsigned int _enum,
142 const StringFlagItem *map);
145 gpi_string_to_enum(
const char *str,
146 unsigned int *result,
147 const StringFlagItem *map);
150 gpi_flags_to_string_list(
const unsigned int flags,
151 const StringFlagItem *map,
152 string_item_func func,
void *data);
155 gpi_string_or_to_flags(
const char *str,
157 const StringFlagItem *map);
160 gpi_string_to_flag(
const char *str,
161 const StringFlagItem *map);
164 gpi_string_list_to_flags(
const char *str[],
165 const StringFlagItem *map);
Log message is a data hex dump.
Definition: gphoto2-port-log.h:34
void gp_logv(GPLogLevel level, const char *domain, const char *format, va_list args)
Log a debug or error message with va_list.
Definition: gphoto2-port-log.c:262
Log message is an verbose debug infomation.
Definition: gphoto2-port-log.h:32
int gp_log_add_func(GPLogLevel level, GPLogFunc func, void *data)
Add a function to get logging information.
Definition: gphoto2-port-log.c:82
Log message is an debug infomation.
Definition: gphoto2-port-log.h:33
GPLogLevel
Logging level Specifies the logging severity level.
Definition: gphoto2-port-log.h:30
Log message is an error infomation.
Definition: gphoto2-port-log.h:31
void gp_log(GPLogLevel level, const char *domain, const char *format,...)
Log a debug or error message.
Definition: gphoto2-port-log.c:321
void(* GPLogFunc)(GPLogLevel level, const char *domain, const char *str, void *data)
Logging function hook.
Definition: gphoto2-port-log.h:61
void gp_log_data(const char *domain, const char *data, unsigned int size)
Log data.
Definition: gphoto2-port-log.c:180
int gp_log_remove_func(int id)
Remove a logging receiving function.
Definition: gphoto2-port-log.c:117