forked from magnito2/autobot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
36 lines (26 loc) · 962 Bytes
/
main.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
from bot import websocket_manager
import logging
import logging.handlers
from pytz import utc
import time
from bot.socketio_handler import SocketIOHandler
logging.Formatter.converter = time.gmtime
class UTCFormatter(logging.Formatter):
converter = time.gmtime
logger = logging.getLogger("renko")
logger.setLevel(logging.DEBUG)
logging.handlers.SocketIOHandler = SocketIOHandler
socketio_handler = SocketIOHandler(None)
utc_formatter = UTCFormatter()
socketio_handler.setFormatter(utc_formatter)
logger.addHandler(socketio_handler)
fh = logging.handlers.RotatingFileHandler("logs/bot.log", maxBytes=100000, backupCount=5)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
formatter.converter = time.gmtime
fh.setFormatter(formatter)
logger.addHandler(fh)
# create console handler with a higher log level
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger.addHandler(ch)
websocket_manager.manage(socketio_handler)