root: add process ID to logging output
This commit is contained in:
parent
4daa70c894
commit
238b489e07
|
@ -0,0 +1,6 @@
|
||||||
|
[settings]
|
||||||
|
multi_line_output=3
|
||||||
|
include_trailing_comma=True
|
||||||
|
force_grid_wrap=0
|
||||||
|
use_parentheses=True
|
||||||
|
line_length=88
|
|
@ -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 import __version__
|
||||||
from passbook.lib.config import CONFIG
|
from passbook.lib.config import CONFIG
|
||||||
|
from passbook.lib.logging import add_process_id
|
||||||
from passbook.lib.sentry import before_send
|
from passbook.lib.sentry import before_send
|
||||||
|
|
||||||
LOGGER = structlog.get_logger()
|
LOGGER = structlog.get_logger()
|
||||||
|
@ -279,6 +280,7 @@ structlog.configure_once(
|
||||||
processors=[
|
processors=[
|
||||||
structlog.stdlib.add_log_level,
|
structlog.stdlib.add_log_level,
|
||||||
structlog.stdlib.add_logger_name,
|
structlog.stdlib.add_logger_name,
|
||||||
|
add_process_id,
|
||||||
structlog.stdlib.PositionalArgumentsFormatter(),
|
structlog.stdlib.PositionalArgumentsFormatter(),
|
||||||
structlog.processors.TimeStamper(),
|
structlog.processors.TimeStamper(),
|
||||||
structlog.processors.StackInfoRenderer(),
|
structlog.processors.StackInfoRenderer(),
|
||||||
|
|
Reference in New Issue