Author: reinhard Date: 2009-11-12 11:31:12 -0600 (Thu, 12 Nov 2009) New Revision: 10040
Modified: trunk/gnue-common/src/base/log.py Log: Format exceptions as we like it - using the "details" from our own exception handling magic. Modified: trunk/gnue-common/src/base/log.py =================================================================== --- trunk/gnue-common/src/base/log.py 2009-11-12 09:05:13 UTC (rev 10039) +++ trunk/gnue-common/src/base/log.py 2009-11-12 17:31:12 UTC (rev 10040) @@ -414,7 +414,11 @@ @rtype: bool """ - __logger().exception(msg, *args, **kwargs) + # We don't use the standard exception handling feature in Python's logging + # module, since we want to show the details as returned by get_exception + # instead of the standard traceback. + (group, name, message, detail) = errors.get_exception() + error(msg + '\n' + detail, *args, **kwargs) return True # ----------------------------------------------------------------------------- @@ -448,7 +452,11 @@ @rtype: bool """ - logging.getLogger(name).exception(msg, *args, **kwargs) + # We don't use the standard exception handling feature in Python's logging + # module, since we want to show the details as returned by get_exception + # instead of the standard traceback. + (group, name, message, detail) = errors.get_exception() + error_n(msg + '\n' + detail, *args, **kwargs) return True # ----------------------------------------------------------------------------- @@ -702,22 +710,7 @@ frame = frame.f_back return ("(unknown file)", 0, "(unknown function)") - def makeRecord(self, name, level, fn, lno, msg, args, exc_info, *vargs): - """ - Create the LogRecord. - In case of an exception, the filename, line number and function name of - the code line causing the exception is substituted. - """ - if exc_info is not None: - (fn, lno, func, text) = traceback.extract_tb(exc_info[2])[-1] - # This parameter only exists with Python 2.5+ - if vargs: - vargs[0] = func - return logging.Logger.makeRecord(self, name, level, fn, lno, msg, args, - exc_info, *vargs) - - # ============================================================================= # Import logging # ============================================================================= _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue