commit 0e773d27ced33b1509e00c7cc8a8a8695f95b9ff
parent 131d2707cd1a69d1024e29c3980c94bc7591db98
Author: nickfarrow <nick@nickfarrow.com>
Date: Fri, 18 Mar 2022 18:33:29 +1100
fix logging in files other than main
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/satsale.py b/satsale.py
@@ -16,9 +16,16 @@ from pprint import pprint
import json
import logging
+import config
+# Initialise logging before importing other modules
+logging.basicConfig(
+ format="[%(asctime)s] [%(levelname)s] %(message)s",
+ datefmt="%Y-%m-%d %H:%M:%S %z",
+ level=getattr(logging, config.loglevel),
+)
+
from gateways import ssh_tunnel
from gateways import paynym
-import config
from payments import database, weakhands
from payments.price_feed import get_btc_value
from node import bitcoind
@@ -28,12 +35,6 @@ from utils import btc_amount_format
from gateways import woo_webhook
-logging.basicConfig(
- format="[%(asctime)s] [%(levelname)s] %(message)s",
- datefmt="%Y-%m-%d %H:%M:%S %z",
- level=getattr(logging, config.loglevel),
-)
-
app = Flask(__name__)
# Load a SatSale API key or create a new one