98 typedef const gchar* QofLogModule;
100 #define QOF_MOD_ENGINE "qof.engine" 104 QOF_LOG_FATAL = G_LOG_LEVEL_ERROR,
105 QOF_LOG_ERROR = G_LOG_LEVEL_CRITICAL,
106 QOF_LOG_WARNING = G_LOG_LEVEL_WARNING,
107 QOF_LOG_MESSAGE = G_LOG_LEVEL_MESSAGE,
108 QOF_LOG_INFO = G_LOG_LEVEL_INFO,
109 QOF_LOG_DEBUG = G_LOG_LEVEL_DEBUG
112 const char* qof_log_level_to_string(QofLogLevel lvl);
113 QofLogLevel qof_log_level_from_string(
const char *str);
172 gboolean
qof_log_check(QofLogModule log_module, QofLogLevel log_level);
174 #define PRETTY_FUNC_NAME qof_log_prettify(G_STRFUNC) 186 #define FATAL(format, ...) do { \ 187 g_log (log_module, G_LOG_LEVEL_ERROR, \ 188 "[%s()] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \ 192 #define PERR(format, ...) do { \ 193 g_log (log_module, G_LOG_LEVEL_CRITICAL, \ 194 "[%s()] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \ 198 #define PWARN(format, ...) do { \ 199 g_log (log_module, G_LOG_LEVEL_WARNING, \ 200 "[%s()] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \ 204 #define PINFO(format, ...) \ 205 if (qof_log_check(log_module, QOF_LOG_INFO) { \ 206 g_log (log_module, G_LOG_LEVEL_INFO, \ 207 "[%s] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \ 211 #define DEBUG(format, ...) \ 212 if (qof_log_check(log_module, QOF_LOG_DEBUG) { \ 213 g_log (log_module, G_LOG_LEVEL_DEBUG, \ 214 "[%s] " format, PRETTY_FUNC_NAME , __VA_ARGS__); \ 218 #define ENTER(format, ...) \ 219 if (qof_log_check(log_module, QOFLOG_DEBUG)) { \ 220 g_log (log_module, G_LOG_LEVEL_DEBUG, \ 221 "[enter %s:%s()] " format, __FILE__, \ 222 PRETTY_FUNC_NAME , __VA_ARGS__); \ 227 #define LEAVE(format, ...) \ 228 if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \ 230 g_log (log_module, G_LOG_LEVEL_DEBUG, \ 231 "[leave %s()] " format, \ 232 PRETTY_FUNC_NAME , __VA_ARGS__); \ 238 #define FATAL(format, args...) do { \ 239 g_log (log_module, G_LOG_LEVEL_ERROR, \ 240 "[%s()] " format, PRETTY_FUNC_NAME , ## args); \ 244 #define PERR(format, args...) do { \ 245 g_log (log_module, G_LOG_LEVEL_CRITICAL, \ 246 "[%s()] " format, PRETTY_FUNC_NAME , ## args); \ 250 #define PWARN(format, args...) do { \ 251 g_log (log_module, G_LOG_LEVEL_WARNING, \ 252 "[%s()] " format, PRETTY_FUNC_NAME , ## args); \ 256 #define PINFO(format, args...) do { \ 257 if (qof_log_check(log_module, QOF_LOG_INFO)) { \ 258 g_log (log_module, G_LOG_LEVEL_INFO, \ 259 "[%s] " format, PRETTY_FUNC_NAME , ## args); \ 264 #define DEBUG(format, args...) do { \ 265 if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \ 266 g_log (log_module, G_LOG_LEVEL_DEBUG, \ 267 "[%s] " format, PRETTY_FUNC_NAME , ## args); \ 272 #define ENTER(format, args...) do { \ 273 if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \ 274 g_log (log_module, G_LOG_LEVEL_DEBUG, \ 275 "[enter %s:%s()] " format, __FILE__, \ 276 PRETTY_FUNC_NAME , ## args); \ 282 #define LEAVE(format, args...) do { \ 283 if (qof_log_check(log_module, QOF_LOG_DEBUG)) { \ 285 g_log (log_module, G_LOG_LEVEL_DEBUG, \ 286 "[leave %s()] " format, \ 287 PRETTY_FUNC_NAME , ## args); \ 294 #define gnc_leave_return_val_if_fail(test, val) do { \ 295 if (! (test)) { LEAVE(""); } \ 296 g_return_val_if_fail(test, val); \ 300 #define gnc_leave_return_if_fail(test) do { \ 301 if (! (test)) { LEAVE(""); } \ 302 g_return_if_fail(test); \ void qof_log_set_level(QofLogModule module, QofLogLevel level)
Set the logging level of the given log_module.
void qof_log_dedent(void)
De-dent one level, capped at 0; see LEAVE macro.
void qof_log_init(void)
Initialize the error logging subsystem.
void qof_log_shutdown(void)
Be nice, close the logfile if possible.
void qof_log_init_filename_special(const char *log_to_filename)
If log_to_filename is "stderr" or "stdout" (exactly, case-insensitive), then those special files are ...
gboolean qof_log_check(QofLogModule log_module, QofLogLevel log_level)
Check to see if the given log_module is configured to log at the given log_level. ...
const gchar * qof_log_prettify(const gchar *name)
Cleans up subroutine names.
void qof_log_init_filename(const gchar *logfilename)
Specify a filename for log output.
void qof_log_indent(void)
Indents one level; see ENTER macro.
void qof_log_parse_log_config(const char *filename)
Parse a log-configuration file.
void qof_log_set_file(FILE *outfile)
Specify an alternate log output, to pipe or file.