Skip to content

Commit

Permalink
DIP-205 log exception if DEBUG=True
Browse files Browse the repository at this point in the history
  • Loading branch information
akameron committed Apr 12, 2016
1 parent 1400293 commit dfb3bd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bluekai/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def run(job, writter, config, logger, datalib, converter):

err = str(ex)
logger.error(err)
if config['DEBUG']:
logger.exception(ex)

finally:
if err:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def test_with_errors(self, do_job_mock):
error = "test_error"
exception = Exception(error)
do_job_mock.side_effect = exception
self.config['DEBUG'] = True
run(self.job_mock, self.writter_mock, self.config, self.logger_mock, self.datalib_mock, self.converter_mock)
self.job_mock.stop.assert_called_once_with()
self.logger_mock.error.assert_called_with(str(exception))
self.logger_mock.exception.assert_called_with(exception)
self.logger_mock.error.assert_called_with(error)
self.logger_mock.info.assert_has_calls([ call("start"), call("end (1 seconds)") ])

Expand Down

0 comments on commit dfb3bd8

Please sign in to comment.