forked from nonjosh/tg-lunch-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
33 lines (26 loc) · 775 Bytes
/
config.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
import os
import sys
import logging
import logging.config
ENROLL_DIR = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'enroll'
))
logging.basicConfig(
filename="app.log",
level=logging.INFO,
format="%(asctime)s %(levelname)s %(module)s - %(funcName)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
logger = logging.getLogger(__name__)
def setup():
if not os.path.isdir(ENROLL_DIR):
os.mkdir(ENROLL_DIR)
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)