| libgphoto2 photo camera library (libgphoto2) API
    2.5.16
    | 
#include "config.h"#include <gphoto2/gphoto2-port-log.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <stdio.h>#include <gphoto2/gphoto2-port-result.h>
| Data Structures | |
| struct | LogFunc | 
| Internal logging function entry.  More... | |
| Macros | |
| #define | _BSD_SOURCE | 
| #define | _(String) (String) | 
| #define | N_(String) (String) | 
| #define | HEXDUMP_OFFSET_WIDTH 4 | 
| #define | HEXDUMP_BLOCK_DISTANCE 2 | 
| #define | HEXDUMP_INIT_X (HEXDUMP_OFFSET_WIDTH + HEXDUMP_BLOCK_DISTANCE) | 
| #define | HEXDUMP_INIT_Y (HEXDUMP_INIT_X + 3 * 16 - 1 + HEXDUMP_BLOCK_DISTANCE) | 
| #define | HEXDUMP_LINE_WIDTH (HEXDUMP_INIT_Y + 16) | 
| #define | HEXDUMP_MIDDLE (HEXDUMP_INIT_X + 3 * 8 - 1) | 
| #define | HEXDUMP_COMPLETE_LINE | 
| Functions | |
| int | gp_log_add_func (GPLogLevel level, GPLogFunc func, void *data) | 
| Add a function to get logging information.  More... | |
| char * | gpi_vsnprintf (const char *format, va_list args) | 
| int | gp_log_remove_func (int id) | 
| Remove a logging receiving function.  More... | |
| void | gp_log_data (const char *domain, const char *data, unsigned int size, const char *format,...) | 
| Log data.  More... | |
| void | gp_logv (GPLogLevel level, const char *domain, const char *format, va_list args) | 
| Log a debug or error message with va_list.  More... | |
| void | gp_log (GPLogLevel level, const char *domain, const char *format,...) | 
| Log a debug or error message.  More... | |
| void | gp_log_with_source_location (GPLogLevel level, const char *file, int line, const char *func, const char *format,...) | 
| #define HEXDUMP_BLOCK_DISTANCE 2 | 
Distance between offset, hexdump and ascii blocks. Note that HEXDUMP_COMPLETE_LINE needs to be changed when this value is changed.
| #define HEXDUMP_COMPLETE_LINE | 
We are lazy and do our typing only once. Please note that you have to add/remove some lines when increasing/decreasing the values of HEXDUMP_BLOCK_DISTANCE and/or HEXDUMP_OFFSET_WIDTH.
| #define HEXDUMP_INIT_X (HEXDUMP_OFFSET_WIDTH + HEXDUMP_BLOCK_DISTANCE) | 
Initial value for x "pointer" (for hexdump)
| #define HEXDUMP_INIT_Y (HEXDUMP_INIT_X + 3 * 16 - 1 + HEXDUMP_BLOCK_DISTANCE) | 
Initial value for y "pointer" (for ascii values)
| #define HEXDUMP_LINE_WIDTH (HEXDUMP_INIT_Y + 16) | 
Used to switch to next line
| #define HEXDUMP_MIDDLE (HEXDUMP_INIT_X + 3 * 8 - 1) | 
Used to put the '-' character in the middle of the hexdumps
| #define HEXDUMP_OFFSET_WIDTH 4 | 
Width of offset field in characters. Note that HEXDUMP_COMPLETE_LINE needs to be changed when this value is changed.
| void gp_log | ( | GPLogLevel | level, | 
| const char * | domain, | ||
| const char * | format, | ||
| ... | |||
| ) | 
Log a debug or error message.
| level | gphoto2 log level | 
| domain | the log domain | 
| format | a printf style format string | 
| ... | the variable argumentlist for above format string | 
Logs a message at the given log level. You would normally use this function to log general debug output in a printf way.
Referenced by gp_port_check_int(), gp_port_check_int_fast(), gp_port_read(), gp_port_usb_msg_class_read(), gp_port_usb_msg_interface_read(), gp_port_usb_msg_read(), and gp_port_write().
| int gp_log_add_func | ( | GPLogLevel | level, | 
| GPLogFunc | func, | ||
| void * | data | ||
| ) | 
Add a function to get logging information.
| level | the maximum level of logging it will get, up to and including the passed value | 
| func | a GPLogFunc | 
| data | 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).
| void gp_log_data | ( | const char * | domain, | 
| const char * | data, | ||
| unsigned int | size, | ||
| const char * | format, | ||
| ... | |||
| ) | 
Log data.
domain the domain data the data to be logged size the size of the data
Takes the data and creates a formatted hexdump string. If you would like to log text messages, use gp_log instead.
| int gp_log_remove_func | ( | int | id | ) | 
Remove a logging receiving function.
| id | an id (return value of gp_log_add_func) | 
Removes the log function with given id.
| void gp_logv | ( | GPLogLevel | level, | 
| const char * | domain, | ||
| const char * | format, | ||
| va_list | args | ||
| ) | 
Log a debug or error message with va_list.
| level | gphoto2 log level | 
| domain | the domain | 
| format | the format | 
| args | the va_list corresponding to format | 
Logs a message at the given log level. You would normally use this function to log as yet unformatted strings.