fixed logfile in settings to allow for adding or removing a logfile
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
import logging
|
||||
from settings import DEBUG
|
||||
from settings import DEBUG, LOGFILE
|
||||
|
||||
|
||||
def init_logger():
|
||||
logging.basicConfig(
|
||||
# filename="logfile.txt",
|
||||
# filemode="a",
|
||||
format="%(pathname)s:%(lineno)d in %(funcName)s\n[%(levelname)s][%(asctime)s](%(name)s) - %(message)s",
|
||||
datefmt="%x %X",
|
||||
)
|
||||
if LOGFILE:
|
||||
logging.basicConfig(
|
||||
filename="logfile.txt",
|
||||
filemode="a",
|
||||
format="%(pathname)s:%(lineno)d in %(funcName)s\n[%(levelname)s][%(asctime)s](%(name)s) - %(message)s",
|
||||
datefmt="%x %X",
|
||||
)
|
||||
else:
|
||||
logging.basicConfig(
|
||||
format="%(pathname)s:%(lineno)d in %(funcName)s\n[%(levelname)s][%(asctime)s](%(name)s) - %(message)s",
|
||||
datefmt="%x %X",
|
||||
)
|
||||
|
||||
_logger = logging.getLogger()
|
||||
|
||||
if DEBUG:
|
||||
|
||||
@@ -13,6 +13,7 @@ MINER_FACTORY_GET_VERSION_RETRIES: int = 3
|
||||
WHATSMINER_PWD = "admin"
|
||||
|
||||
DEBUG = False
|
||||
LOGFILE = False
|
||||
|
||||
settings_keys = {}
|
||||
|
||||
@@ -47,3 +48,6 @@ if "whatsminer_pwd" in settings_keys:
|
||||
|
||||
if "debug" in settings_keys:
|
||||
DEBUG: int = settings["debug"]
|
||||
|
||||
if "logfile" in settings_keys:
|
||||
LOGFILE: bool = settings["logfile"]
|
||||
|
||||
@@ -13,6 +13,8 @@ reboot_threads = 300
|
||||
|
||||
whatsminer_pwd = "admin"
|
||||
|
||||
logfile = true
|
||||
|
||||
### DEBUG MODE ###
|
||||
# change this to debug = true
|
||||
# to enable debug mode.
|
||||
|
||||
Reference in New Issue
Block a user