Make it possible to configure log level for exception tracebacks (#1311)

If you set `log.traceback_level=DEBUG`, the tracebacks will be visible only when `log.level=DEBUG`. The default behavior remains the same.
This commit is contained in:
Igor Yanchenko
2019-12-03 15:13:42 +01:00
committed by Alexander Kukushkin
parent f1819443ef
commit 49d3968c23
5 changed files with 24 additions and 2 deletions
+2 -1
View File
@@ -22,6 +22,7 @@ class TestPatroniLogger(unittest.TestCase):
def test_patroni_logger(self):
config = {
'log': {
'traceback_level': 'DEBUG',
'max_queue_size': 5,
'dir': 'foo',
'file_size': 4096,
@@ -50,7 +51,7 @@ class TestPatroniLogger(unittest.TestCase):
logger.reload_config(config['log'])
with patch.object(logging.Logger, 'makeRecord',
Mock(side_effect=[logging.LogRecord('', logging.INFO, '', 0, '', (), None), Exception])):
logging.error('test')
logging.exception('test')
logging.error('test')
with patch.object(Queue, 'put_nowait', Mock(side_effect=Full)):
self.assertRaises(SystemExit, logger.shutdown)