Message Log Level Proposals



Other than the names, what's the difference between G_LOG_LEVEL_INFO and
G_LOG_LEVEL_MESSAGE?  If there is no significant difference, deprecate
one of them.  Also, these messages should go to standard output.  All
other message levels should go to standard error.

G_LOG_LEVEL_DEBUG messages should always contain file, line, and
function (using the G_STRLOC macro) and should only be active when
G_ENABLE_DEBUG is defined.  Example, "DEBUG: file
gobject.c:165:g_object_notify(): object class `foo' has no property
named `bar'."

The behavior of G_LOG_LEVEL_CRITICAL and G_LOG_LEVEL_ERROR messages is
sorta backwards.  Critical messages should mean that a fatal condition
was detected (usually by assertions).  This condition indicates that a
core dump is imminent and should instead gracefully call the abort()
function.  Example, "CRITICAL: width can't be divided by zero!"

An error is a run-time condition that should be caught by the
application and recovered from if possible.  If possible, then the
program should use the g_warning() function or g_log with the
G_LOG_LEVEL_WARNING level.  Example, "WARNING: low on memory, using
reserve storage."  If not possible, use the g_error() function (or
G_LOG_LEVEL_ERROR level) which calls the exit() function with an
EXIT_FAILURE status.  Example, "ERROR: file 'xyz' not found!"

Thoughts?  Opinions?

Eric.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]