Typedefs | |
| typedef void(*) | GGZDebugHandlerFunc (int priority, const char *msg) |
| A callback function to handle debugging output. | |
Enumerations | |
| enum | GGZCheckType { GGZ_CHECK_NONE = 0x00, GGZ_CHECK_MEM = 0x01 } |
| What memory checks should we do? More... | |
Functions | |
| void | ggz_debug_init (const char **types, const char *file) |
| Initialize and configure debugging for the program. | |
| GGZDebugHandlerFunc | ggz_debug_set_func (GGZDebugHandlerFunc func) |
| Set the debug handler function. | |
| void | ggz_debug_enable (const char *type) |
| Enable a specific type of debugging. | |
| void | ggz_debug_disable (const char *type) |
| Disable a specific type of debugging. | |
| void | ggz_debug (const char *type, const char *fmt,...) ggz__attribute((format(printf |
| Log a debugging message. | |
| void void | ggz_log (const char *type, const char *fmt,...) ggz__attribute((format(printf |
| Log a notice message. | |
| void void void | ggz_error_sys (const char *fmt,...) ggz__attribute((format(printf |
| Log a syscall error. | |
| void void void void | ggz_error_sys_exit (const char *fmt,...) ggz__attribute((format(printf |
| Log a fatal syscall error. | |
| void void void void | ggz__attribute ((noreturn)) |
| void | ggz_error_msg (const char *fmt,...) ggz__attribute((format(printf |
| Log an error message. | |
| void void | ggz_error_msg_exit (const char *fmt,...) ggz__attribute((format(printf |
| Log a fatal error message. | |
| void | ggz_debug_cleanup (GGZCheckType check) |
| Cleans up debugging state and prepares for exit. | |
| typedef void(*) GGZDebugHandlerFunc(int priority, const char *msg) |
A callback function to handle debugging output.
A function of this type can be registered as a callback handler to handle debugging output, rather than having the output go to stderr or to a file. If this is done, each line of output will be sent directly to this function (no trailing newline will be appended).
| priority | The priority of the log, i.e. LOG_DEBUG; see syslog() | |
| msg | The debugging output message |
| enum GGZCheckType |
| void ggz_debug_init | ( | const char ** | types, | |
| const char * | file | |||
| ) |
Initialize and configure debugging for the program.
This should be called early in the program to set up the debugging routines.
| types | A null-terminated list of arbitrary string debugging "types" | |
| file | A file to write debugging output to, or NULL for none |
| GGZDebugHandlerFunc ggz_debug_set_func | ( | GGZDebugHandlerFunc | func | ) |
Set the debug handler function.
Call this function to register a debug handler function. NULL can be passed to disable the debug handler. If set, the debug handler function will be called to handle debugging output, overriding any file that had previously been specified.
| func | The new debug handler function |
| void ggz_debug_enable | ( | const char * | type | ) |
Enable a specific type of debugging.
Any ggz_debug() calls that use that type will then be logged.
| type | The "type" of debugging to enable |
| void ggz_debug_disable | ( | const char * | type | ) |
Disable a specific type of debugging.
Any ggz_debug() calls that use the given type of debugging will then not be logged.
| type | The "type" of debugging to disable |
| void ggz_debug | ( | const char * | type, | |
| const char * | fmt, | |||
| ... | ||||
| ) |
Log a debugging message.
This function takes a debugging "type" as well as a printf-style list of arguments. It assembles the debugging message (printf-style) and logs it if the given type of debugging is enabled.
| type | The "type" of debugging (similar to a loglevel) | |
| fmt | A printf-style format string |
| void void ggz_log | ( | const char * | type, | |
| const char * | fmt, | |||
| ... | ||||
| ) |
Log a notice message.
This function is nearly identical to ggz_debug(), except that if the debugging output ends up passed to the debug handler function, the priority will be LOG_NOTICE instead of LOG_DEBUG. This is only of interest to a few programs.
| type | The "type" of debugging (similar to a loglevel) | |
| fmt | A printf-style format string |
| void void void ggz_error_sys | ( | const char * | fmt, | |
| ... | ||||
| ) |
Log a syscall error.
This logs an error message in a similar manner to ggz_debug()'s debug logging. However, the logging is done regardless of whether debugging is enabled or what debugging types are set. errno and strerror are also used to create a more useful message.
| fmt | A printf-style format string |
| void void void void ggz_error_sys_exit | ( | const char * | fmt, | |
| ... | ||||
| ) |
Log a fatal syscall error.
This logs an error message just like ggz_error_sys(), and also exits the program.
| fmt | A printf-style format string |
| void ggz_error_msg | ( | const char * | fmt, | |
| ... | ||||
| ) |
Log an error message.
This logs an error message in a similar manner to ggz_debug()'s debug logging. However, the logging is done regardless of whether debugging is enabled or what debugging types are set.
| fmt | A printf-style format string |
| void void ggz_error_msg_exit | ( | const char * | fmt, | |
| ... | ||||
| ) |
Log a fatal error message.
This logs an error message just like ggz_error_msg(), and also exits the program.
| fmt | A printf-style format string |
| void ggz_debug_cleanup | ( | GGZCheckType | check | ) |
Cleans up debugging state and prepares for exit.
This function should be called right before the program exits. It cleans up all of the debugging state data, including writing out the memory check data (if enabled) and closing the debugging file (if enabled).
| check | A mask of things to check |
1.5.1