def errors_log_fatal_error (domain, msg): """Records the presence of a fatal error to the debug log (see debuglog). This condition can be checked later with errors_have_fatal_error(). @domain: name of debug log domain @msg: message to print to the debug log""" global _have_fatal_error _have_fatal_error = True debuglog.debug_log (True, domain, "Got fatal error: %s" % msg)
def errors_exit_with_fatal_exception (domain, log_config_filename): """Exits the program when a fatal exception has occurred. First, this logs the current exception to the debug log. Then, it dumps the debug log to stderr and exits the program with exit code util.EXIT_CODE_FATAL. @domain: name of debug log domain @log_config_filename: File to mention in the debug log as the source for its configuration Return value: this function does not return, as it exits the program.""" debuglog.debug_log (True, domain, "Fatal exception! Exiting abnormally.") debuglog.debug_log_current_exception (domain) debuglog.debug_log_dump_to_file (log_config_filename, sys.stderr) sys.exit (util.EXIT_CODE_FATAL)
def dprint (fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_USER_PROFILE, fmt % args)
def dprint (fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_ADMIN_TOOL, fmt % args)
def dprint(fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_CACHE, fmt % args)
def dprint(fmt, *args): debuglog.debug_log(False, debuglog.DEBUG_LOG_DOMAIN_GCONF_SOURCE, fmt % args)
def mprint (fmt, *args): debuglog.debug_log (True, debuglog.DEBUG_LOG_DOMAIN_PROTO_SESSION, fmt % args)
def mprint(fmt, *args): debuglog.debug_log(True, debuglog.DEBUG_LOG_DOMAIN_ADMIN_TOOL, fmt % args)
def dprint (fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_DIR_MONITOR, fmt % args)
def dprint (fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_PANEL_DELEGATE, fmt % args)
import debuglog import sys debuglog.debug_log_load_configuration ("test-debug-log.conf") for i in range (1000): is_milestone = (i % 10 == 0) m = i % 3 if m == 0: domain = "foo" elif m == 1: domain = "bar" elif m == 2: domain = debuglog.DEBUG_LOG_DOMAIN_USER debuglog.debug_log (is_milestone, domain, "%s" % i) print "logged %s" % i debuglog.debug_log_dump_to_file ("test-debug-log.conf",sys.stderr)
def dprint (fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_SESSION_WIDGET, fmt % args)