[Sugar-devel] [PATCH 14/21 sugar-toolkit] sugar.util: use logging.exception instead of traceback.format_exc()

Simon Schampijer simon at schampijer.de
Fri Oct 29 06:57:40 EDT 2010


Reviewed-by: Simon Schampijer simon at laptop.org

On 10/15/2010 11:01 PM, Sascha Silbe wrote:
> logging.exception() handles exceptions nicely for us, no need to explicitly
> use traceback.
>
> Signed-off-by: Sascha Silbe<sascha-pgp at silbe.org>
>
> diff --git a/src/sugar/util.py b/src/sugar/util.py
> index 889cc62..e0a431b 100644
> --- a/src/sugar/util.py
> +++ b/src/sugar/util.py
> @@ -29,7 +29,6 @@ import gettext
>   import tempfile
>   import logging
>   import atexit
> -import traceback
>
>
>   _ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
> @@ -336,7 +335,7 @@ def _cleanup_temp_files():
>           try:
>               os.unlink(path)
>           except:
> -            logging.error(traceback.format_exc())
> +            logging.exception('Exception occured in _cleanup_temp_files')
>
>   atexit.register(_cleanup_temp_files)
>
> --
> 1.7.1
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>



More information about the Sugar-devel mailing list