diff --git a/sbapp/main.py b/sbapp/main.py index 61d36aa..7f539e6 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1,15 +1,29 @@ +__version__ = "0.1.9" +__variant__ = "beta" + +import sys +import argparse +parser = argparse.ArgumentParser(description="Reticulum Network Stack Daemon") +parser.add_argument("-v", "--verbose", action='store_true', default=False, help="increase logging verbosity") +parser.add_argument("--version", action="version", version="sideband {version}".format(version=__version__)) +args = parser.parse_args() + +print(sys.argv) +sys.argv = [sys.argv[0]] + import RNS import LXMF import time -import sys import os import plyer import base64 import threading from kivy.logger import Logger, LOG_LEVELS -# Logger.setLevel(LOG_LEVELS["debug"]) -Logger.setLevel(LOG_LEVELS["error"]) +if args.verbose: + Logger.setLevel(LOG_LEVELS["debug"]) +else: + Logger.setLevel(LOG_LEVELS["error"]) if RNS.vendor.platformutils.get_platform() != "android": local = os.path.dirname(__file__) @@ -51,9 +65,6 @@ from kivy.metrics import dp from kivymd.uix.button import MDFlatButton from kivymd.uix.dialog import MDDialog -__version__ = "0.1.9" -__variant__ = "beta" - dark_theme_text_color = "ddd" if RNS.vendor.platformutils.get_platform() == "android": @@ -78,7 +89,7 @@ class SidebandApp(MDApp): if RNS.vendor.platformutils.get_platform() == "android": self.sideband = SidebandCore(self, is_client=True, android_app_dir=self.app_dir) else: - self.sideband = SidebandCore(self, is_client=False) + self.sideband = SidebandCore(self, is_client=False, verbose=args.verbose) self.update_ui_theme() diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 0993ef2..e389c9d 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -71,7 +71,7 @@ class SidebandCore(): # stream logger self.log_announce(destination_hash, app_data, dest_type=SidebandCore.aspect_filter) - def __init__(self, owner_app, is_service=False, is_client=False, android_app_dir=None): + def __init__(self, owner_app, is_service=False, is_client=False, android_app_dir=None, verbose=False): self.is_service = is_service self.is_client = is_client @@ -80,6 +80,7 @@ class SidebandCore(): else: self.is_standalone = False + self.log_verbose = verbose self.owner_app = owner_app self.reticulum = None @@ -908,7 +909,12 @@ class SidebandCore(): self.service_thread.start() def __start_jobs_immediate(self): - self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=2) + if self.log_verbose: + selected_level = 7 + else: + selected_level = 2 + + self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=selected_level) if RNS.vendor.platformutils.get_platform() == "android": if not self.reticulum.is_connected_to_shared_instance: