#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>Include dependency graph for gphoto2-port-log.c:

Data Structures | |
| struct | LogFunc |
| Internal logging function entry. More... | |
Defines | |
| #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. | |
| int | gp_log_remove_func (int id) |
| Remove a logging receiving function. | |
| void | gp_log_data (const char *domain, const char *data, unsigned int size) |
| Log data domain the domain data the data to be logged size the size of the data. | |
| void | gp_logv (GPLogLevel level, const char *domain, const char *format, va_list args) |
| Log a debug or error message with va_list. | |
| void | gp_log (GPLogLevel level, const char *domain, const char *format,...) |
| Log a debug or error message. | |
| #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 |
Value:
{\
curline[HEXDUMP_OFFSET_WIDTH - 4] = hexchars[(index >> 12) & 0xf]; \
curline[HEXDUMP_OFFSET_WIDTH - 3] = hexchars[(index >> 8) & 0xf]; \
curline[HEXDUMP_OFFSET_WIDTH - 2] = hexchars[(index >> 4) & 0xf]; \
curline[HEXDUMP_OFFSET_WIDTH - 1] = '0'; \
curline[HEXDUMP_OFFSET_WIDTH + 0] = ' '; \
curline[HEXDUMP_OFFSET_WIDTH + 1] = ' '; \
curline[HEXDUMP_MIDDLE] = '-'; \
curline[HEXDUMP_INIT_Y-2] = ' '; \
curline[HEXDUMP_INIT_Y-1] = ' '; \
curline[HEXDUMP_LINE_WIDTH] = '\n'; \
curline = curline + (HEXDUMP_LINE_WIDTH + 1);}
| #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 |
| 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 |
| void gp_log_data | ( | const char * | domain, | |
| const char * | data, | |||
| unsigned int | size | |||
| ) |
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) |
| 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 |
1.5.1