diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 000000000..ba2778dc8 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,6 @@ +[settings] +multi_line_output=3 +include_trailing_comma=True +force_grid_wrap=0 +use_parentheses=True +line_length=88 diff --git a/passbook/lib/logging.py b/passbook/lib/logging.py new file mode 100644 index 000000000..38a75f3bd --- /dev/null +++ b/passbook/lib/logging.py @@ -0,0 +1,9 @@ +"""logging helpers""" +from os import getpid + + +# pylint: disable=unused-argument +def add_process_id(logger, method_name, event_dict): + """Add the current process ID""" + event_dict["pdi"] = getpid() + return event_dict diff --git a/passbook/root/settings.py b/passbook/root/settings.py index ad77d239c..ca8b419f7 100644 --- a/passbook/root/settings.py +++ b/passbook/root/settings.py @@ -22,6 +22,7 @@ from sentry_sdk.integrations.django import DjangoIntegration from passbook import __version__ from passbook.lib.config import CONFIG +from passbook.lib.logging import add_process_id from passbook.lib.sentry import before_send LOGGER = structlog.get_logger() @@ -279,6 +280,7 @@ structlog.configure_once( processors=[ structlog.stdlib.add_log_level, structlog.stdlib.add_logger_name, + add_process_id, structlog.stdlib.PositionalArgumentsFormatter(), structlog.processors.TimeStamper(), structlog.processors.StackInfoRenderer(),