|
@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
|
11
|
11
|
"""
|
12
|
12
|
|
13
|
13
|
import config
|
|
14
|
+from logging.handlers import SocketHandler as _SocketHandler
|
14
|
15
|
import os
|
15
|
16
|
import stat
|
16
|
17
|
import sys
|
|
@@ -194,8 +195,14 @@ PERSISTENT_SESSION_VARIABLES = []
|
194
|
195
|
|
195
|
196
|
# Logging Configuration
|
196
|
197
|
#
|
197
|
|
-debug_handler = 'console'
|
198
|
|
-default_handler = [debug_handler] if DEBUG else ['console']
|
|
198
|
+class DjangoSocketHandler(_SocketHandler):
|
|
199
|
+ def emit(self, record):
|
|
200
|
+ if hasattr(record, 'request'):
|
|
201
|
+ record.request = None
|
|
202
|
+ return super().emit(record)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+default_handler = ['socket'] if DEBUG else ['console']
|
199
|
206
|
#
|
200
|
207
|
LOGGING = {
|
201
|
208
|
'version': 1,
|
|
@@ -218,36 +225,22 @@ File "%(pathname)s", line %(lineno)d, in %(funcName)s
|
218
|
225
|
'class': 'logging.StreamHandler',
|
219
|
226
|
'formatter': 'short',
|
220
|
227
|
},
|
221
|
|
- 'console_long': {
|
|
228
|
+ 'socket': {
|
222
|
229
|
'level': 'DEBUG',
|
223
|
|
- 'class': 'logging.StreamHandler',
|
224
|
|
- 'formatter': 'long',
|
|
230
|
+ 'class': 'main.settings.DjangoSocketHandler',
|
|
231
|
+ 'host': '127.0.0.1',
|
|
232
|
+ 'port': 19996,
|
225
|
233
|
},
|
226
|
234
|
},
|
227
|
235
|
'loggers': {
|
228
|
|
- 'AUTH': {
|
229
|
|
- 'handlers': default_handler,
|
230
|
|
- 'level': 'INFO',
|
231
|
|
- 'propagate': False,
|
232
|
|
- },
|
233
|
|
- 'ACC': {
|
234
|
|
- 'handlers': default_handler,
|
235
|
|
- 'level': 'INFO',
|
236
|
|
- 'propagate': False,
|
237
|
|
- },
|
238
|
|
- 'APP': {
|
239
|
|
- 'handlers': default_handler,
|
240
|
|
- 'level': 'INFO',
|
241
|
|
- 'propagate': False,
|
242
|
|
- },
|
243
|
|
- 'WHOOSH': {
|
|
236
|
+ 'django': {
|
244
|
237
|
'handlers': default_handler,
|
245
|
238
|
'level': 'INFO',
|
246
|
239
|
'propagate': False,
|
247
|
240
|
},
|
248
|
|
- 'FSTOOLS': {
|
|
241
|
+ config.APP_NAME: {
|
249
|
242
|
'handlers': default_handler,
|
250
|
|
- 'level': 'INFO',
|
|
243
|
+ 'level': 'DEBUG' if DEBUG else 'INFO',
|
251
|
244
|
'propagate': False,
|
252
|
245
|
},
|
253
|
246
|
},
|