Merge fad4ef5b36
into 583dfdd941
This commit is contained in:
commit
8770fd3174
|
@ -9,7 +9,7 @@ env:
|
||||||
- TOXENV=py35
|
- TOXENV=py35
|
||||||
install:
|
install:
|
||||||
- pip install -U pip
|
- pip install -U pip
|
||||||
- pip install -U Flask tox coverage codecov
|
- pip install -U Flask tox coverage codecov celery
|
||||||
script:
|
script:
|
||||||
- tox
|
- tox
|
||||||
after_success:
|
after_success:
|
||||||
|
|
|
@ -32,6 +32,11 @@ no value is present in the message record.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
try:
|
||||||
|
from celery import current_task:
|
||||||
|
except ImportError:
|
||||||
|
current_task = None
|
||||||
|
|
||||||
from flask import has_request_context, request
|
from flask import has_request_context, request
|
||||||
|
|
||||||
__version_info__ = ('0', '0', '1')
|
__version_info__ = ('0', '0', '1')
|
||||||
|
@ -134,7 +139,9 @@ class FlaskExtraLogger(logging.getLoggerClass()):
|
||||||
|
|
||||||
# If we were asked to log the blueprint name, add it to the extra list
|
# If we were asked to log the blueprint name, add it to the extra list
|
||||||
if self._blueprint_var is not None:
|
if self._blueprint_var is not None:
|
||||||
if has_request_context():
|
if current_task:
|
||||||
|
kwargs['extra'][self._blueprint_var] = current_task.name
|
||||||
|
elif has_request_context():
|
||||||
kwargs['extra'][self._blueprint_var] = request.blueprint or self._blueprint_app
|
kwargs['extra'][self._blueprint_var] = request.blueprint or self._blueprint_app
|
||||||
else:
|
else:
|
||||||
kwargs['extra'][self._blueprint_var] = self._blueprint_norequest
|
kwargs['extra'][self._blueprint_var] = self._blueprint_norequest
|
||||||
|
|
Loading…
Reference in New Issue