diff --git a/docs/changelog.rst b/docs/changelog.rst index 0c048dc..0325791 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,10 @@ Change history ============== +1.3.0a5 (2018-11-20) + +* traceback.print_exc() --> logging.error. + 1.3.0a4 (2018-11-15) * Add ErrHandler.handler_assertion_error. diff --git a/hobbit_core/__init__.py b/hobbit_core/__init__.py index 1d4711a..77a43c9 100644 --- a/hobbit_core/__init__.py +++ b/hobbit_core/__init__.py @@ -1 +1 @@ -VERSION = [1, 3, 0, 'a4'] +VERSION = [1, 3, 0, 'a5'] diff --git a/hobbit_core/flask_hobbit/err_handler.py b/hobbit_core/flask_hobbit/err_handler.py index 6513fc9..45f3c4d 100644 --- a/hobbit_core/flask_hobbit/err_handler.py +++ b/hobbit_core/flask_hobbit/err_handler.py @@ -1,10 +1,12 @@ # -*- encoding: utf-8 -*- -import traceback +import logging from sqlalchemy.orm import exc as orm_exc from .response import Result, ServerErrorResult, gen_response, RESP_MSGS +logger = logging.getLogger(__name__) + class ErrHandler(object): """Base error handler that catch all exceptions. Be sure response is:: @@ -44,7 +46,7 @@ def handler_assertion_error(cls, e): @classmethod def handler_others(cls, e): - traceback.print_exc() + logging.error('UncheckedException:', exc_info=1) return ServerErrorResult(code=500, detail=repr(e)) @classmethod