fix: Move logger before imports to ensure it is initialized before logs start
All checks were successful
Tests and Linting / Tests-Linting (3.11) (push) Successful in 29s
Tests and Linting / Tests-Linting (3.10) (push) Successful in 31s
Tests and Linting / Tests-Linting (3.13) (push) Successful in 32s
Build Docker / Build Images (map[dockerfile:Dockerfile tag_suffix: target:default]) (push) Successful in 46s
Build Docker / Build Images (map[dockerfile:Dockerfile.hsd tag_suffix:-hsd target:hsd]) (push) Successful in 47s
All checks were successful
Tests and Linting / Tests-Linting (3.11) (push) Successful in 29s
Tests and Linting / Tests-Linting (3.10) (push) Successful in 31s
Tests and Linting / Tests-Linting (3.13) (push) Successful in 32s
Build Docker / Build Images (map[dockerfile:Dockerfile tag_suffix: target:default]) (push) Successful in 46s
Build Docker / Build Images (map[dockerfile:Dockerfile.hsd tag_suffix:-hsd target:hsd]) (push) Successful in 47s
This commit is contained in:
@@ -5,3 +5,4 @@ SHOW_EXPIRED=false
|
|||||||
EXPLORER_TX=https://shakeshift.com/transaction/
|
EXPLORER_TX=https://shakeshift.com/transaction/
|
||||||
DISABLE_WALLETDNS=false
|
DISABLE_WALLETDNS=false
|
||||||
INTERNAL_HSD=false
|
INTERNAL_HSD=false
|
||||||
|
LOG_LEVEL=WARNING
|
||||||
42
main.py
42
main.py
@@ -7,13 +7,9 @@ from flask import Flask, make_response, redirect, request, jsonify, render_templ
|
|||||||
import os
|
import os
|
||||||
import dotenv
|
import dotenv
|
||||||
import requests
|
import requests
|
||||||
import account as account_module
|
|
||||||
import render
|
|
||||||
import re
|
import re
|
||||||
from flask_qrcode import QRcode
|
from flask_qrcode import QRcode
|
||||||
import domainLookup
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import plugin as plugins_module
|
|
||||||
import gitinfo
|
import gitinfo
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
@@ -22,18 +18,6 @@ from logging.handlers import RotatingFileHandler
|
|||||||
|
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
qrcode = QRcode(app)
|
|
||||||
|
|
||||||
|
|
||||||
# Change this if network fees change
|
|
||||||
fees = 0.02
|
|
||||||
revokeCheck = random.randint(100000,999999)
|
|
||||||
|
|
||||||
|
|
||||||
THEME = os.getenv("THEME", "black")
|
|
||||||
|
|
||||||
|
|
||||||
# Setup logging
|
# Setup logging
|
||||||
if not os.path.exists('logs'):
|
if not os.path.exists('logs'):
|
||||||
os.makedirs('logs')
|
os.makedirs('logs')
|
||||||
@@ -42,15 +26,38 @@ handler = RotatingFileHandler(log_file, maxBytes=1024*1024, backupCount=3)
|
|||||||
formatter = logging.Formatter('[%(asctime)s] %(levelname)s in %(module)s: %(message)s')
|
formatter = logging.Formatter('[%(asctime)s] %(levelname)s in %(module)s: %(message)s')
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
log_level = os.getenv("LOG_LEVEL", "WARNING").upper()
|
||||||
|
if log_level in ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]:
|
||||||
|
logger.setLevel(getattr(logging, log_level))
|
||||||
|
else:
|
||||||
logger.setLevel(logging.WARNING)
|
logger.setLevel(logging.WARNING)
|
||||||
|
|
||||||
# Disable werkzeug logging
|
# Disable werkzeug logging
|
||||||
logging.getLogger('werkzeug').setLevel(logging.INFO)
|
logging.getLogger('werkzeug').setLevel(logging.INFO)
|
||||||
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
logging.getLogger("urllib3").setLevel(logging.ERROR)
|
||||||
logging.getLogger("requests").setLevel(logging.ERROR)
|
logging.getLogger("requests").setLevel(logging.ERROR)
|
||||||
|
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
# Import after logger setup to capture logs from these modules
|
||||||
|
import render # noqa: E402
|
||||||
|
import domainLookup # noqa: E402
|
||||||
|
import account as account_module # noqa: E402
|
||||||
|
import plugin as plugins_module # noqa: E402
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
qrcode = QRcode(app)
|
||||||
|
|
||||||
|
|
||||||
|
# Change this if network fees change
|
||||||
|
fees = 0.02
|
||||||
|
revokeCheck = random.randint(100000,999999)
|
||||||
|
|
||||||
|
THEME = os.getenv("THEME", "black")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
# Check if the user is logged in
|
# Check if the user is logged in
|
||||||
@@ -2095,7 +2102,6 @@ if __name__ == '__main__':
|
|||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
app.run(debug=True, host=host, port=port)
|
app.run(debug=True, host=host, port=port)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
app.run(host=host, port=port)
|
app.run(host=host, port=port)
|
||||||
|
|
||||||
def tests():
|
def tests():
|
||||||
|
|||||||
Reference in New Issue
Block a user