QOF
0.8.7
|
Files | |
file | qoflog.h |
QOF error logging and tracing facility. | |
Macros | |
#define | QOF_MOD_ENGINE "qof-engine" |
#define | LOG_LEVEL_LIST(_) |
#define | FUNK qof_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) |
Typedefs | |
typedef void(* | QofLogCB) (QofLogModule log_module, QofLogLevel *log_level, gpointer user_data) |
Enumerations | |
enum | QofLogLevel { QOF_LOG_FATAL = 0, QOF_LOG_ERROR = 1, QOF_LOG_WARNING = 2, QOF_LOG_INFO = 3, QOF_LOG_DEBUG = 4, QOF_LOG_DETAIL = 5, QOF_LOG_TRACE = 6 } |
Functions | |
const gchar * | QofLogLevelasString (QofLogLevel n) |
QofLogLevel | QofLogLevelfromString (const gchar *str) |
void | qof_log_add_indent (void) |
gint | qof_log_get_indent (void) |
void | qof_log_drop_indent (void) |
void | qof_log_init (void) |
void | qof_log_set_level (QofLogModule module, QofLogLevel level) |
void | qof_log_set_level_registered (QofLogLevel level) |
void | qof_log_set_file (FILE *outfile) |
void | qof_log_init_filename (const gchar *logfilename) |
void | qof_log_shutdown (void) |
const gchar * | qof_log_prettify (const gchar *name) |
gboolean | qof_log_check (QofLogModule log_module, QofLogLevel log_level) |
void | qof_log_set_default (QofLogLevel log_level) |
void | qof_log_module_foreach (QofLogCB cb, gpointer data) |
gint | qof_log_module_count (void) |
#define DEBUG | ( | format, | |
args... | |||
) |
Print a debugging message
#define DEBUGCMD | ( | x | ) |
#define ENTER | ( | format, | |
args... | |||
) |
Print a function entry debugging message
#define FATAL | ( | format, | |
args... | |||
) |
Log error/warning/info messages to stderr or to a file. This logging infrastructure is meant for validating the correctness of the execution of the code. 'Info' level messages help trace program flow. 'Error' messages are meant to indicate internal data inconsistencies.
Messages can be logged to stdout, stderr, or to any desired file.Log a fatal error
#define LEAVE | ( | format, | |
args... | |||
) |
Print a function exit debugging message
#define LOG_LEVEL_LIST | ( | _ | ) |
#define PERR | ( | format, | |
args... | |||
) |
Log a serious error
#define PINFO | ( | format, | |
args... | |||
) |
Print an informational note
#define PWARN | ( | format, | |
args... | |||
) |
Log a warning
#define TRACE | ( | format, | |
args... | |||
) |
Print a function trace debugging message
enum QofLogLevel |
void qof_log_add_indent | ( | void | ) |
gboolean qof_log_check | ( | QofLogModule | log_module, |
QofLogLevel | log_level | ||
) |
void qof_log_drop_indent | ( | void | ) |
gint qof_log_get_indent | ( | void | ) |
void qof_log_init | ( | void | ) |
Initialize the error logging subsystem
Instead, use qof_log_init_filename which sets the filename and initialises the logging subsystem in one operation.
Definition at line 74 of file qoflog.c.
void qof_log_init_filename | ( | const gchar * | logfilename | ) |
Specify a filename for log output.
Calls qof_log_init() for you.
gint qof_log_module_count | ( | void | ) |
void qof_log_module_foreach | ( | QofLogCB | cb, |
gpointer | data | ||
) |
const gchar* qof_log_prettify | ( | const gchar * | name | ) |
qof_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 QOF_LOG_MAX_CHARS chars.
Definition at line 177 of file qoflog.c.
void qof_log_set_default | ( | QofLogLevel | log_level | ) |
Set the default QOF log_modules to the log level.
Definition at line 232 of file qoflog.c.
void qof_log_set_file | ( | FILE * | outfile | ) |
Specify an alternate log output, to pipe or file. By default, all logging goes to /tmp/qof.trace
Needs to be called before qof_log_init()
void qof_log_set_level | ( | QofLogModule | module, |
QofLogLevel | level | ||
) |
void qof_log_set_level_registered | ( | QofLogLevel | level | ) |
Set the logging level for all registered log_modules.
"silent" log_modules are supported by the qof_log_set_level_registered function which only moderates log_levels for those modules actually registered. The advantage is that a developer can omit existing log_modules from the init code and cut down the amount of unwanted logging.
e.g. if you are working in one section of the code and do not want the extra log information created by allowing the default modules to log as well. This makes the log itself easier to use when working in a small area of the codebase. Silent log_modules can also be useful where no default currently exists - again to isolate certain sections of the default log output - and using qof_log_set_level_registered allows these silent log_modules to be retained in the code without being logged by other developers etc.
void qof_log_shutdown | ( | void | ) |
const gchar* QofLogLevelasString | ( | QofLogLevel | n | ) |
Convert a QofLogLevel to the log_string
Only for use as a partner to QofLogLevelfromString
QofLogLevel QofLogLevelfromString | ( | const gchar * | str | ) |
Convert the log_string to a QofLogLevel
Only for use as a partner to QofLogLevelasString