Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions BrowserStackAutomation/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import json
from pathlib import Path
import os
import time
import random

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -45,7 +47,13 @@
"social_django",
"Access",
"rest_framework",
'cid.apps.CidAppConfig',
]
CID_GENERATE = True
CID_GENERATOR = lambda: f'{time.time()}-{random.random()}'
CID_HEADER = 'X_CORRELATION_ID'
CID_GENERATE = True
CID_CONCATENATE_IDS = True

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
Expand All @@ -56,6 +64,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"social_django.middleware.SocialAuthExceptionMiddleware",
"cid.middleware.CidMiddleware",
]

AUTHENTICATION_BACKENDS = (
Expand Down Expand Up @@ -226,3 +235,52 @@

AUTOMATED_EXEC_IDENTIFIER = 'automated-grant'

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': "[cid: %(cid)s]:{\"meta\":{\"timestamp\":\"%(asctime)s.%(msecs)03dZ\",\"component\":\"django\",\"application\":\"enigma\",\"team\":\"core\"},\"log\":{\"kind\":\"ENIGMA_APP\",\"dynamic_data\":\"[%(name)s:%(funcName)s:%(lineno)s] --- %(message)s\",\"level\":\"%(levelname)s\"}}",
'datefmt': "%Y-%m-%dT%H:%M:%S"
}
},
'handlers': {
'file': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': './bstack.log',
'formatter': 'verbose',
},
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {
'handlers': ['file', 'console'],
'level': 'INFO',
'propagate': True,
'formatter' : 'verbose',
},
'inventory': {
'handlers': ['file', 'console'],
'level': 'INFO',
'propagate': True,
'formatter' : 'verbose',
},
'Access':{
'handlers': ['file', 'console'],
'level': 'INFO',
'propagate': True,
'formatter' : 'verbose',
},
'bootprocess':{
'handlers': ['file', 'console'],
'level': 'INFO',
'propagate': True,
'formatter' : 'verbose',
},
},
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ eradicate==2.1.0
mypy==1.0.0
mypy-extensions==1.0.0
vulture==2.7
django-cid==2.3
flake8==6.0.0