misc: do not log invalid json content error if log_errors is False (#22661)

This commit is contained in:
Frédéric Péters 2018-03-21 10:41:33 +01:00
parent 1933eb6a9f
commit 8796c9892a
1 changed files with 4 additions and 1 deletions

View File

@ -961,7 +961,10 @@ class JsonCellBase(CellBase):
except ValueError:
extra_context[data_key + '_error'] = 'invalid_json'
logger = logging.getLogger(__name__)
logger.error('invalid json content (%s)', url)
if log_errors:
logger.error('invalid json content (%s)', url)
else:
logger.debug('invalid json content (%s)', url)
continue
elif json_response.headers.get('content-type') == 'application/json':
try: