-
Notifications
You must be signed in to change notification settings - Fork 103
/
settings.py
54 lines (48 loc) · 1.42 KB
/
settings.py
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
import logging
DATABASE_ENGINE = "sqlite" # sqlite or mysql
DATABASE_NAME = "PyCrawler" # Database name
DATABASE_HOST = "/PyCrawler.db" # Host address of mysql server or file location of sqlite db
DATABASE_PORT = "" # Port number as a string. Not used with sqlite
DATABASE_USER = "" # Not used with sqlite
DATABASE_PASS = "" # Not used with sqlite
DEBUG = True # Whether or not to show DEBUG level messages
USE_COLORS = True # Whether or not colors should be used when outputting text
LOGGING = { # dictConfig for output stream and file logging
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'console': {
'format': '[%(asctime)s] %(levelname)s::%(module)s - %(message)s',
},
'file': {
'format': '[%(asctime)s] %(levelname)s::(P:%(process)d T:%(thread)d)::%(module)s - %(message)s',
},
},
'handlers': {
'console': {
'class': 'ColorStreamHandler.ColorStreamHandler',
'formatter':'console',
'level': 'DEBUG',
'use_colors': USE_COLORS,
},
'file': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'formatter':'file',
'level': 'INFO',
'when': 'midnight',
'filename': 'pycrawler.log',
'interval': 1,
'backupCount': 0,
'encoding': None,
'delay': False,
'utc': False,
},
},
'loggers': {
'crawler_logger': {
'handlers': ['console', 'file'],
'level': 'DEBUG' if DEBUG else 'INFO',
'propagate': True,
},
}
}