Browse Source

Simplify startup logging

pull/1880/head
Safihre 4 years ago
parent
commit
9588fe8d94
  1. 59
      SABnzbd.py

59
SABnzbd.py

@ -79,6 +79,7 @@ import sabnzbd.downloader
import sabnzbd.notifier as notifier import sabnzbd.notifier as notifier
import sabnzbd.zconfig import sabnzbd.zconfig
from sabnzbd.getipaddress import localipv4, publicipv4, ipv6 from sabnzbd.getipaddress import localipv4, publicipv4, ipv6
from sabnzbd.utils.getperformance import getpystone, getcpu
import sabnzbd.utils.ssdp as ssdp import sabnzbd.utils.ssdp as ssdp
try: try:
@ -1172,25 +1173,13 @@ def main():
).strip() ).strip()
except: except:
pass pass
logging.info("Commit: %s", sabnzbd.__baseline__) logging.info("Commit = %s", sabnzbd.__baseline__)
logging.info("Full executable path = %s", sabnzbd.MY_FULLNAME) logging.info("Full executable path = %s", sabnzbd.MY_FULLNAME)
if sabnzbd.WIN32: logging.info("Platform = %s - %s", os.name, platform.platform())
suffix = ""
if win64:
suffix = "(win64)"
try:
logging.info("Platform = %s %s", platform.platform(), suffix)
except:
logging.info("Platform = %s <unknown>", suffix)
else:
logging.info("Platform = %s", os.name)
logging.info("CPU architecture = %s", platform.uname().machine) # as .processor is not always filled out logging.info("CPU architecture = %s", platform.uname().machine) # as .processor is not always filled out
logging.info("Python-version = %s", sys.version) logging.info("Python-version = %s", sys.version)
logging.info("Arguments = %s", sabnzbd.CMDLINE) logging.info("Arguments = %s", sabnzbd.CMDLINE)
if sabnzbd.DOCKER: logging.info("Dockerized = %s", sabnzbd.DOCKER)
logging.info("Running inside a docker container")
else:
logging.info("Not inside a docker container")
# Find encoding; relevant for external processing activities # Find encoding; relevant for external processing activities
logging.info("Preferred encoding = %s", sabnzbd.encoding.CODEPAGE) logging.info("Preferred encoding = %s", sabnzbd.encoding.CODEPAGE)
@ -1214,8 +1203,8 @@ def main():
try: try:
os.environ["SSL_CERT_FILE"] = certifi.where() os.environ["SSL_CERT_FILE"] = certifi.where()
logging.info("Certifi version: %s", certifi.__version__) logging.info("Certifi version = %s", certifi.__version__)
logging.info("Loaded additional certificates from: %s", os.environ["SSL_CERT_FILE"]) logging.info("Loaded additional certificates from %s", os.environ["SSL_CERT_FILE"])
except: except:
# Sometimes the certificate file is blocked # Sometimes the certificate file is blocked
logging.warning(T("Could not load additional certificates from certifi package")) logging.warning(T("Could not load additional certificates from certifi package"))
@ -1224,38 +1213,16 @@ def main():
# Extra startup info # Extra startup info
if sabnzbd.cfg.log_level() > 1: if sabnzbd.cfg.log_level() > 1:
# List the number of certificates available (can take up to 1.5 seconds) # List the number of certificates available (can take up to 1.5 seconds)
ctx = ssl.create_default_context() logging.debug("Available certificates = %s", repr(ssl.create_default_context().cert_store_stats()))
logging.debug("Available certificates: %s", repr(ctx.cert_store_stats()))
mylocalipv4 = localipv4()
if mylocalipv4:
logging.debug("My local IPv4 address = %s", mylocalipv4)
else:
logging.debug("Could not determine my local IPv4 address")
mypublicipv4 = publicipv4()
if mypublicipv4:
logging.debug("My public IPv4 address = %s", mypublicipv4)
else:
logging.debug("Could not determine my public IPv4 address")
myipv6 = ipv6() # List networking
if myipv6: logging.debug("Local IPv4 address = %s", localipv4())
logging.debug("My IPv6 address = %s", myipv6) logging.debug("Public IPv4 address = %s", publicipv4())
else: logging.debug("IPv6 address = %s", ipv6())
logging.debug("Could not determine my IPv6 address")
# Measure and log system performance measured by pystone and - if possible - CPU model # Measure and log system performance measured by pystone and - if possible - CPU model
from sabnzbd.utils.getperformance import getpystone, getcpu logging.debug("CPU Pystone available performance = %s", getpystone())
logging.debug("CPU model = %s", getcpu())
pystoneperf = getpystone()
if pystoneperf:
logging.debug("CPU Pystone available performance = %s", pystoneperf)
else:
logging.debug("CPU Pystone available performance could not be calculated")
cpumodel = getcpu() # Linux only
if cpumodel:
logging.debug("CPU model = %s", cpumodel)
logging.info("Using INI file %s", inifile) logging.info("Using INI file %s", inifile)

Loading…
Cancel
Save