Go to the source code of this file.
Defines | |
#define | DEBUG_ERROR 0 |
#define | DEBUG_STATE 1 |
#define | DEBUG_COMM 2 |
#define | DEBUG_DATA 3 |
#define | DEBUG_CALLS 4 |
#define | DEBUG_LEVEL DEBUG_CALLS |
The perferred debug level written inside the code, higher than this level the code is omitted. | |
#define | DEBUG_ROUTINE "unknown" |
#define | dbg_error(...) dbg_log(DEBUG_ERROR, DEBUG_ROUTINE, __VA_ARGS__) |
Send errors to the log. | |
#define | dbg_fatal(...) { dbg_log(DEBUG_ERROR, DEBUG_ROUTINE, __VA_ARGS__); exit(1); } |
#define | dbg_state(...) dbg_log(DEBUG_STATE, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about the program state. | |
#define | dbg_comm(...) dbg_log(DEBUG_COMM, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about communication. | |
#define | dbg_data(...) dbg_log(DEBUG_DATA, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about changes to data. | |
#define | dbg_calls(...) dbg_log(DEBUG_CALLS, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about calls to functions. | |
Functions | |
void | dbg_init (const char *file) |
Open the logfile. | |
void | dbg_log (const int prio, const char *routine, const char *format,...) |
Log something. | |
void | dbg_level (const int prio, const char *routine) |
Set the debug level for a routine. |
Routines that can write usefull notes to a logfile.
It's possible to enable logging for different modules of the program even during the runtime of the program. It's also possible to disable the more detailed logging code at compile time so there is no overhead in the final release from excessive log messages.
#define dbg_calls | ( | ... | ) | dbg_log(DEBUG_CALLS, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about calls to functions.
#define dbg_comm | ( | ... | ) | dbg_log(DEBUG_COMM, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about communication.
#define dbg_data | ( | ... | ) | dbg_log(DEBUG_DATA, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about changes to data.
#define dbg_error | ( | ... | ) | dbg_log(DEBUG_ERROR, DEBUG_ROUTINE, __VA_ARGS__) |
Send errors to the log.
#define dbg_fatal | ( | ... | ) | { dbg_log(DEBUG_ERROR, DEBUG_ROUTINE, __VA_ARGS__); exit(1); } |
#define dbg_state | ( | ... | ) | dbg_log(DEBUG_STATE, DEBUG_ROUTINE, __VA_ARGS__) |
Send debug messages about the program state.
#define DEBUG_CALLS 4 |
#define DEBUG_COMM 2 |
#define DEBUG_DATA 3 |
#define DEBUG_ERROR 0 |
#define DEBUG_LEVEL DEBUG_CALLS |
The perferred debug level written inside the code, higher than this level the code is omitted.
#define DEBUG_ROUTINE "unknown" |
#define DEBUG_STATE 1 |
void dbg_init | ( | const char * | file | ) |
Open the logfile.
When not called or on a failure stderr will be used for logging.
file | The logfile to open |
void dbg_level | ( | const int | prio, | |
const char * | routine | |||
) |
Set the debug level for a routine.
prio | The priority of messages that will be show, higher means more detailed logging. | |
routine | The debug name of the routine as defined at the start of the .cc file usually its name. A NULL will result in setting the general debug level for every routine that has no specific level set. |
void dbg_log | ( | const int | prio, | |
const char * | routine, | |||
const char * | format, | |||
... | ||||
) |
Log something.
Prefer the marcro's above this function for smaller code on a low DEBUG_LEVEL
prio | the priority of this log message | |
routine | the routine where this code is a part of | |
format | a ANSI-C style format string | |
... | parameters used with the format string |
Generated on Tue Jan 1 17:30:01 2008 for general/log.h File Reference by
Visit the project page on