Skip to content

Commit 91360d3

Browse files
authored
Merge pull request #53 from TTWShell/enhance/logger
use logger instead of print && upgrade to 1.3.0a5
2 parents bfa00c1 + 4c67de7 commit 91360d3

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

docs/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Change history
22
==============
33

4+
1.3.0a5 (2018-11-20)
5+
6+
* traceback.print_exc() --> logging.error.
7+
48
1.3.0a4 (2018-11-15)
59

610
* Add ErrHandler.handler_assertion_error.

hobbit_core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = [1, 3, 0, 'a4']
1+
VERSION = [1, 3, 0, 'a5']

hobbit_core/flask_hobbit/err_handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# -*- encoding: utf-8 -*-
2-
import traceback
2+
import logging
33

44
from sqlalchemy.orm import exc as orm_exc
55

66
from .response import Result, ServerErrorResult, gen_response, RESP_MSGS
77

8+
logger = logging.getLogger(__name__)
9+
810

911
class ErrHandler(object):
1012
"""Base error handler that catch all exceptions. Be sure response is::
@@ -44,7 +46,7 @@ def handler_assertion_error(cls, e):
4446

4547
@classmethod
4648
def handler_others(cls, e):
47-
traceback.print_exc()
49+
logging.error('UncheckedException:', exc_info=1)
4850
return ServerErrorResult(code=500, detail=repr(e))
4951

5052
@classmethod

0 commit comments

Comments
 (0)