Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Trace: Error Reporting and Debugging
[Query Object Framework]


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,...)


Define Documentation

#define DEBUG (  format,
args...   ) 
 

Value:

{                   \
  if (gnc_should_log (module, GNC_LOG_DEBUG)) {    \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,        \
      "Debug: %s(): " format, FUNK , ## args);     \
  }                                                \
}
Print an debugging message

#define ENTER (  format,
args...   ) 
 

Value:

{                   \
  if (gnc_should_log (module, GNC_LOG_DEBUG)) {    \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,        \
      "Enter: %s" format, FUNK , ## args);         \
  }                                                \
}
Print an function entry debugging message

#define FATAL (  format,
args...   ) 
 

Value:

{                     \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR,          \
      "Fatal Error: %s(): " format, FUNK , ## args); \
}
Log an fatal error

#define LEAVE (  format,
args...   ) 
 

Value:

{                   \
  if (gnc_should_log (module, GNC_LOG_DEBUG)) {    \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,        \
      "Leave: %s" format, FUNK , ## args);         \
  }                                                \
}
Print an function exit debugging message

#define PERR (  format,
args...   ) 
 

Value:

{                    \
  if (gnc_should_log (module, GNC_LOG_ERROR)) {    \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,     \
      "Error: %s(): " format, FUNK , ## args);     \
  }                                                \
}
Log an serious error

#define PINFO (  format,
args...   ) 
 

Value:

{                   \
  if (gnc_should_log (module, GNC_LOG_INFO)) {     \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO,         \
      "Info: %s(): " format, FUNK , ## args);      \
  }                                                \
}
Print an informational note

#define PWARN (  format,
args...   ) 
 

Value:

{                   \
  if (gnc_should_log (module, GNC_LOG_WARNING)) {  \
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,      \
      "Warning: %s(): " format, FUNK , ## args);   \
  }                                                \
}
Log an warning

#define REPORT_CLOCK (  clockno,
format,
args...   ) 
 

Value:

{             \
  if (gnc_should_log (module, GNC_LOG_INFO))                \
    gnc_report_clock (clockno, module, GNC_LOG_INFO,        \
             __FUNCTION__, format , ## args);               \
}
report elapsed time since last report on a particular timer

#define REPORT_CLOCK_TOTAL (  clockno,
format,
args...   ) 
 

Value:

{       \
  if (gnc_should_log (module, GNC_LOG_INFO))                \
    gnc_report_clock_total (clockno, module, GNC_LOG_INFO,  \
             __FUNCTION__, format , ## args);               \
}
report total elapsed time since timer started

#define START_CLOCK (  clockno,
format,
args...   ) 
 

Value:

{              \
  if (gnc_should_log (module, GNC_LOG_INFO))                \
    gnc_start_clock (clockno, module, GNC_LOG_INFO,         \
             __FUNCTION__, format , ## args);               \
}
start a particular timer

#define TRACE (  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);     \
  }                                                \
}
Print an function trace debugging message


Enumeration Type Documentation

enum gncModuleType
 

If you modify this, modify the loglevel table in the .c file.


Function Documentation

void gnc_log_init (  void   ) 
 

Initialize the error logging subsystem

const char* gnc_log_prettify (  const char *  name  ) 
 

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.

void gnc_set_log_level (  gncModuleType  module,
gncLogLevel  level
) 
 

Set the logging level of the given module.

void gnc_set_log_level_global (  gncLogLevel  level  ) 
 

Set the logging level for all modules.

void gnc_set_logfile (  FILE *  outfile  ) 
 

Specify an alternate log output, to pipe or file. By default, all logging goes to STDERR.

void gnc_start_clock (  int  clockno,
gncModuleType  module,
gncLogLevel  log_level,
const char *  function_name,
const char *  format,
  ...
) 
 

Infrastructure to make timing measurements for critical peices of code. Used for only for performance tuning & debugging.


Generated on Sun May 23 15:41:47 2004 for QOF by doxygen 1.3.6-20040222