From 3334aa662f78cd101e4d2eb73badafe8c1101771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Sat, 7 Dec 2024 18:11:32 -0300 Subject: [PATCH] Waitress --- main.py | 6 ++++++ utils/statistics_server_v3.py | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index ba277b0..5ee1299 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,7 @@ import json import os import sys import time +import logging from threading import Thread from waitress import serve @@ -2256,6 +2257,11 @@ if __name__=="__main__": import_instance(x) broker.logger.log_this(f"All instances imported!",2) + + #Waitress logging + waitress_logger = logging.getLogger('waitress') + waitress_logger.setLevel(logging.INFO) + #Threads to run: main loop and flask api main_threads = [Thread(target=main_loop,args=()),Thread(target=run_API,args=())] diff --git a/utils/statistics_server_v3.py b/utils/statistics_server_v3.py index 8b0cdd4..4ad7281 100644 --- a/utils/statistics_server_v3.py +++ b/utils/statistics_server_v3.py @@ -5,7 +5,9 @@ import time import ccxt import credentials import requests +import logging from flask import Flask, jsonify, request +from waitress import serve ''' @@ -597,13 +599,14 @@ def total_profit_by_pair(): if __name__=="__main__": - # Load valid keys from database valid_keys = load_keys_from_db("api_credentials.db") #Waitress - #serve(stats_api,host="0.0.0.0",port=5010) - - #Dev server - stats_api.run(host="0.0.0.0",port=5010) + logger = logging.getLogger('waitress') + logger.setLevel(logging.INFO) + serve(stats_api,host="0.0.0.0",port=5010) + + #Flask + # app.run(host="0.0.0.0", port=5010, debug=True) \ No newline at end of file