-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.py
More file actions
75 lines (66 loc) · 2.03 KB
/
settings.py
File metadata and controls
75 lines (66 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- coding: utf-8 -*-
# @Author: theo-l
# @Date: 2017-09-08 10:22:29
# @Last Modified by: theo-l
# @Last Modified time: 2017-09-08 11:01:26
# API response status code & message pair
import os
RESPONSE_CODE_NAME = 'code'
RESPONSE_MSG_NAME = 'msg'
# 通用的log文件所在目录
COMMON_LOG_BASE_DIR='/usr/log'
# common model fields, which used in the base resource class
MODEL_COMMON_FIELDS = ['created_at', 'enabled', 'updated_at']
LOGGING = {
'version' : 1,
'disable_existing_loggers': False,
'formatters' : {
'verbose': {
'format': '[%(asctime)s] [%(levelname)s] [%(module)s.%(funcName)s] %(message)s'
},
'simple' : {
'format': '[%(module)s.%(funcName)s] %(message)s'
},
},
'handlers' : {
'debug' : {
'level' : 'DEBUG',
'class' : 'logging.FileHandler',
'filename' : os.path.join(COMMON_LOG_BASE_DIR, 'django-debug.log'),
'formatter': 'verbose'
},
'warning' : {
'level' : 'WARNING',
'class' : 'logging.FileHandler',
'filename' : os.path.join(COMMON_LOG_BASE_DIR, 'django-warning.log'),
'formatter': 'verbose'
},
'console': {
'level' : 'DEBUG' ,
'class' : 'logging.StreamHandler',
'formatter': 'simple'
},
},
'loggers' : {
'debug': {
'handlers' : ['debug', 'console'],
'level' : 'DEBUG',
'propagate': True,
},
'warning': {
'handlers' : ['warning', 'console'],
'level' : 'WARNING',
'propagate': True,
},
'system': {
'handlers' : ['warning', 'console'],
'level' : 'WARNING',
'propagate': True,
},
'api' : {
'handlers' : ['debug', 'console'],
'level' : 'DEBUG' ,
'propagate': True,
},
},
}