Files | |
file | gnc-trace.h |
GnuCash error loging and tracing facility. | |
Defines | |
#define | FUNK gnc_log_prettify(__FUNCTION__) |
#define | FATAL(format, args...) |
#define | PERR(format, args...) |
#define | PWARN(format, args...) |
#define | PINFO(format, args...) |
#define | DEBUG(format, args...) |
#define | ENTER(format, args...) |
#define | LEAVE(format, args...) |
#define | TRACE(format, args...) |
#define | DEBUGCMD(x) { if (gnc_should_log (module, GNC_LOG_DEBUG)) { (x); }} |
#define | START_CLOCK(clockno, format, args...) |
#define | REPORT_CLOCK(clockno, format, args...) |
#define | REPORT_CLOCK_TOTAL(clockno, format, args...) |
Enumerations | |
enum | gncModuleType { MOD_DUMMY = 0, MOD_ENGINE = 1, MOD_IO = 2, MOD_REGISTER = 3, MOD_LEDGER = 4, MOD_HTML = 5, MOD_GUI = 6, MOD_SCRUB = 7, MOD_GTK_REG = 8, MOD_GUILE = 9, MOD_BACKEND = 10, MOD_QUERY = 11, MOD_PRICE = 12, MOD_EVENT = 13, MOD_TXN = 14, MOD_KVP = 15, MOD_SX = 16, MOD_BOOK = 17, MOD_TEST = 18, MOD_LOT = 19, MOD_ACCOUNT = 20, MOD_IMPORT = 21, MOD_BUSINESS = 22, MOD_DRUID = 23, MOD_COMMODITY = 24, MOD_LAST = 24 } |
enum | gncLogLevel { GNC_LOG_FATAL = 0, GNC_LOG_ERROR = 1, GNC_LOG_WARNING = 2, GNC_LOG_INFO = 3, GNC_LOG_DEBUG = 4, GNC_LOG_DETAIL = 5, GNC_LOG_TRACE = 6 } |
Functions | |
void | gnc_log_init (void) |
void | gnc_set_log_level (gncModuleType module, gncLogLevel level) |
void | gnc_set_log_level_global (gncLogLevel level) |
void | gnc_set_logfile (FILE *outfile) |
const char * | gnc_log_prettify (const char *name) |
gboolean | gnc_should_log (gncModuleType module, gncLogLevel log_level) |
void | gnc_start_clock (int clockno, gncModuleType module, gncLogLevel log_level, const char *function_name, const char *format,...) |
void | gnc_report_clock (int clockno, gncModuleType module, gncLogLevel log_level, const char *function_name, const char *format,...) |
void | gnc_report_clock_total (int clockno, gncModuleType module, gncLogLevel log_level, const char *function_name, const char *format,...) |
|
Value: { \ if (gnc_should_log (module, GNC_LOG_DEBUG)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "Debug: %s(): " format, FUNK , ## args); \ } \ } |
|
Value: { \ if (gnc_should_log (module, GNC_LOG_DEBUG)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "Enter: %s" format, FUNK , ## args); \ } \ } |
|
Value: { \
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
"Fatal Error: %s(): " format, FUNK , ## args); \
}
|
|
Value: { \ if (gnc_should_log (module, GNC_LOG_DEBUG)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "Leave: %s" format, FUNK , ## args); \ } \ } |
|
Value: { \ if (gnc_should_log (module, GNC_LOG_ERROR)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ "Error: %s(): " format, FUNK , ## args); \ } \ } |
|
Value: { \ if (gnc_should_log (module, GNC_LOG_INFO)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ "Info: %s(): " format, FUNK , ## args); \ } \ } |
|
Value: { \ if (gnc_should_log (module, GNC_LOG_WARNING)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ "Warning: %s(): " format, FUNK , ## args); \ } \ } |
|
Value: { \
if (gnc_should_log (module, GNC_LOG_INFO)) \
gnc_report_clock (clockno, module, GNC_LOG_INFO, \
__FUNCTION__, format , ## args); \
}
|
|
Value: { \
if (gnc_should_log (module, GNC_LOG_INFO)) \
gnc_report_clock_total (clockno, module, GNC_LOG_INFO, \
__FUNCTION__, format , ## args); \
}
|
|
Value: { \ if (gnc_should_log (module, GNC_LOG_INFO)) \ gnc_start_clock (clockno, module, GNC_LOG_INFO, \ __FUNCTION__, format , ## args); \ } |
|
Value: { \ if (gnc_should_log (module, GNC_LOG_TRACE)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ "Trace: %s(): " format, FUNK , ## args); \ } \ } |
|
If you modify this, modify the loglevel table in the .c file. |
|
Initialize the error logging subsystem |
|
gnc_log_prettify() cleans up subroutine names. AIX/xlC has the habit of printing signatures not names; clean this up. On other operating systems, truncate name to 30 chars. Note this routine is not thread safe. Note we wouldn't need this routine if AIX did something more reasonable. Hope thread safety doesn't poke us in eye. |
|
Set the logging level of the given module. |
|
Set the logging level for all modules. |
|
Specify an alternate log output, to pipe or file. By default, all logging goes to STDERR. |
|
Infrastructure to make timing measurements for critical peices of code. Used for only for performance tuning & debugging. |