Create variables for logging

Moved settings file due to it's inaccessability when installing as module
Clean code

Related-Prod: PRODX-48948

Change-Id: I3490f3f12360831530f6e976eaa5e4682a648e1d
diff --git a/rp_reporter/rp_reporter/batch_reporter.py b/rp_reporter/rp_reporter/batch_reporter.py
index dd67349..23a3ce4 100755
--- a/rp_reporter/rp_reporter/batch_reporter.py
+++ b/rp_reporter/rp_reporter/batch_reporter.py
@@ -2,16 +2,15 @@
 import logging
 import ipdb
 import itertools
-import sys
+import sys, os
 
 import jenkins_jinny.main as jj
 from copy import deepcopy
+from pathlib import Path
 
 from .report_from_xml import report_xml, timestamp
 from .report_from_xml import client as rp_client
-
-sys.path.append('../rp_reporter')
-import settings
+from .settings import RP_ENDPOINT, RP_PROJECT
 
 LOG = logging.getLogger(__name__)
 
@@ -25,31 +24,15 @@
         "start_time": job.start_time.strftime("%Y-%m-%d-%H-%M-%S")
     }
     if context_name:=job.param.OPENSTACK_CONTEXT_NAME:
-        tags.update(
-            {
-                "openstack": context_name.split("/")[0],
-                "context": context_name.split("/")[-1],
-            }
-        )
+        tags["openstack"] = context_name.split("/")[0]
+        tags["context"] = context_name.split("/")[-1]
 
     if "mosk-24.3" in job.name:
-        tags.update(
-            {
-                "mosk_version": "mosk-24.3"
-            }
-        )
+        tags["mosk_version"] = "mosk-24.3"
     elif "mosk-25.1" in job.name:
-        tags.update(
-            {
-                "mosk_version": "mosk-25.1"
-            }
-        )
+        tags["mosk_version"] = "mosk-25.1"
     else:
-        tags.update(
-            {
-                "mosk_version": "master"
-            }
-        )
+        tags["mosk_version"] = "master"
 
     # deploy_job = job.get_child_jobs("deploy-openstack-k8s-env")[0]
     # for file_location in deploy_job.get_artifacts("deployed.yaml"):
@@ -59,11 +42,12 @@
 
     launch_id = None
     if suite_per_job:
-        launch_id = rp_client.start_launch(name=f"{job.name} number: {job.number}",
-                            start_time=timestamp(),
-                            attributes=tags,
-                            description=f"Main job {job.url}"
-                            )
+        launch_id = rp_client.start_launch(
+            name=f"{job.name} number: {job.number}",
+            start_time=timestamp(),
+            attributes=tags,
+            description=f"Main job {job.url}"
+        )
 
     for child in itertools.chain([job], job.heirs):
         print(f"⫍‍⌕‍⫎ tests in {child}")
@@ -131,7 +115,7 @@
             rp_client.finish_launch(end_time=timestamp())
             LOG.info(rp_client.get_launch_info())
     if suite_per_job:
-        report_url = f"{settings.RP_ENDPOINT.strip('/')}/ui/#{settings.RP_PROJECT}/launches/all/{launch_id}"
+        report_url = f"{RP_ENDPOINT.strip('/')}/ui/#{RP_PROJECT}/launches/all/{launch_id}"
         print(f"maybe report is here {report_url}")
     print(f" ʕノ•ᴥ•ʔノ Completed")
 
diff --git a/rp_reporter/rp_reporter/report_from_xml.py b/rp_reporter/rp_reporter/report_from_xml.py
index 52fe9e6..f6c33c9 100644
--- a/rp_reporter/rp_reporter/report_from_xml.py
+++ b/rp_reporter/rp_reporter/report_from_xml.py
@@ -8,19 +8,14 @@
 import wget
 import sys
 import time
+from pathlib import Path
 
 from reportportal_client import RPClient
 from reportportal_client.helpers import timestamp
 
-sys.path.append('../rp_reporter')
-import settings
+from .settings import RP_ENDPOINT, RP_APIKEY, RP_PROJECT
 
-logging.basicConfig(level=logging.INFO,
-                    format='%(asctime)s %(levelname)s - %(filename)s:%(lineno)d (%(funcName)s) - %(message)s',
-                    filename='report.log',
-                    filemode='w')
 LOG = logging.getLogger(__name__)
-LOG.setLevel(logging.WARNING)
 scheduled = []
 
 def schedule_finishing(item):
@@ -33,9 +28,9 @@
                                 end_time=timestamp()
                                 )
 
-client = RPClient(endpoint=settings.RP_ENDPOINT,
-              project=settings.RP_PROJECT,
-              api_key=settings.RP_APIKEY,
+client = RPClient(endpoint=RP_ENDPOINT,
+              project=RP_PROJECT,
+              api_key=RP_APIKEY,
               is_skipped_an_issue=False,
               truncate_attributes=False
               )
diff --git a/rp_reporter/settings.py b/rp_reporter/rp_reporter/settings.py
similarity index 80%
rename from rp_reporter/settings.py
rename to rp_reporter/rp_reporter/settings.py
index 13f6a6c..d238d91 100644
--- a/rp_reporter/settings.py
+++ b/rp_reporter/rp_reporter/settings.py
@@ -28,6 +28,13 @@
 RP_PROJECT = environ.get('RP_PROJECT') or from_conf('RP_PROJECT') or call_error("RP_PROJECT")
 
 RP_LOG_FILE = environ.get('RP_LOG_FILE') or from_conf('RP_LOG_FILE') or (Path.cwd() / "report.log")
+RP_LOGGING = environ.get('RP_LOGGING') or from_conf('RP_LOGGING') or logging.INFO
+
+logging.basicConfig(level=RP_LOGGING,
+                    format='%(asctime)s %(levelname)s - %(filename)s:%(lineno)d (%(funcName)s) - %(message)s',
+                    filename=RP_LOG_FILE,
+                    filemode='w'
+                    )
 
 if __name__ == "__main__":
     LOG.info(f"RP_APIKEY: {RP_APIKEY}")
diff --git a/rp_reporter/setup.py b/rp_reporter/setup.py
index c94d350..abf7b6c 100644
--- a/rp_reporter/setup.py
+++ b/rp_reporter/setup.py
@@ -10,7 +10,7 @@
     long_description_content_type="text/markdown",
     packages=find_packages(),
     install_requires=[
-        "xunitparser",  # List dependencies here
+        "xunitparser",
         "reportportal-client",
         "PyYAML",
         "wget",