21 #ifndef __GPHOTO2_PORT_LOG_H__
22 #define __GPHOTO2_PORT_LOG_H__
46 #define GP_LOG_ALL GP_LOG_DATA
63 const char *format, va_list args,
void *data)
65 __attribute__((__format__(printf,3,0)))
69 #ifndef DISABLE_DEBUGGING
76 const char *format, ...)
78 __attribute__((__format__(printf,3,4)))
84 __attribute__((__format__(printf,3,0)))
87 void gp_log_data (
const char *domain,
const char *data,
unsigned int size);
101 #ifdef _GPHOTO2_INTERNAL_CODE
102 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
103 #define GP_DEBUG(...) \
104 gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, __VA_ARGS__)
105 #elif defined(__GNUC__) && __GNUC__ >= 2
106 #define GP_DEBUG(msg, params...) \
107 gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, msg, ##params)
110 # warning Disabling GP_DEBUG because variadic macros are not allowed
112 #define GP_DEBUG (void)
119 #define gp_log_add_func(level, func, data) (0)
120 #define gp_log_remove_func(id) (0)
121 #define gp_log(level, domain, format, args...)
122 #define gp_logv(level, domain, format, args)
123 #define gp_log_data(domain, data, size)
125 #ifdef _GPHOTO2_INTERNAL_CODE
126 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
127 #define GP_DEBUG(...)
128 #elif defined(__GNUC__)
129 #define GP_DEBUG(msg, params...)
131 #define GP_DEBUG (void)
137 #ifdef _GPHOTO2_INTERNAL_CODE
139 typedef struct StringFlagItem {
144 typedef void (*string_item_func) (
const char *str,
void *data);
147 gpi_enum_to_string(
const unsigned int _enum,
148 const StringFlagItem *map);
151 gpi_string_to_enum(
const char *str,
152 unsigned int *result,
153 const StringFlagItem *map);
156 gpi_flags_to_string_list(
const unsigned int flags,
157 const StringFlagItem *map,
158 string_item_func func,
void *data);
161 gpi_string_or_to_flags(
const char *str,
163 const StringFlagItem *map);
166 gpi_string_to_flag(
const char *str,
167 const StringFlagItem *map);
170 gpi_string_list_to_flags(
const char *str[],
171 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:260
void(* GPLogFunc)(GPLogLevel level, const char *domain, const char *format, va_list args, void *data)
Logging function hook.
Definition: gphoto2-port-log.h:62
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:80
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:293
void gp_log_data(const char *domain, const char *data, unsigned int size)
Log data.
Definition: gphoto2-port-log.c:178
int gp_log_remove_func(int id)
Remove a logging receiving function.
Definition: gphoto2-port-log.c:115