root: add process ID to logging output
This commit is contained in:
parent
4daa70c894
commit
238b489e07
6
.isort.cfg
Normal file
6
.isort.cfg
Normal file
|
@ -0,0 +1,6 @@
|
|||
[settings]
|
||||
multi_line_output=3
|
||||
include_trailing_comma=True
|
||||
force_grid_wrap=0
|
||||
use_parentheses=True
|
||||
line_length=88
|
9
passbook/lib/logging.py
Normal file
9
passbook/lib/logging.py
Normal file
|
@ -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
|
|
@ -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(),
|
||||
|
|
Reference in a new issue