mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-01-09 16:27:53 +05:30
more logging messages and code cleanup
Removed log messages from config.py
This commit is contained in:
parent
33156e6a8d
commit
a3e9b45050
@ -36,4 +36,4 @@ See README.md for documentation.
|
||||
#
|
||||
# In case you forgot to change the version, skip the number
|
||||
# and put the next number in the next commit.
|
||||
__version__ = "0.3.0a2"
|
||||
__version__ = "0.3.0a2.dev1"
|
||||
|
@ -46,7 +46,8 @@ from pathlib import Path
|
||||
from configparser import ConfigParser
|
||||
from argparse import ArgumentParser, Namespace
|
||||
from naxalnet.default import CONFIG, CONFIG_FILES, CONFIG_DIRS
|
||||
from naxalnet.log import logger
|
||||
|
||||
# from naxalnet.log import logger
|
||||
|
||||
|
||||
def get_config_files():
|
||||
@ -70,14 +71,14 @@ def parse_config():
|
||||
Parse all configuration files, with the values in
|
||||
default.py as fallback
|
||||
"""
|
||||
logger.debug("Parsing config files")
|
||||
# logger.debug("Parsing config files")
|
||||
parser = ConfigParser()
|
||||
# encoded defaults
|
||||
parser.read_dict(CONFIG)
|
||||
# read config files
|
||||
files = get_config_files()
|
||||
for i in files:
|
||||
logger.debug("Reading config file %s", str(i))
|
||||
# logger.debug("Reading config file %s", str(i))
|
||||
parser.read_file(i.open())
|
||||
return parser
|
||||
|
||||
@ -145,5 +146,5 @@ def parse_args() -> Namespace:
|
||||
help="prints the version and exit",
|
||||
)
|
||||
|
||||
logger.debug("Parsing arguments")
|
||||
# logger.debug("Parsing arguments")
|
||||
return parser.parse_args()
|
||||
|
@ -310,11 +310,13 @@ class Adapter:
|
||||
"""power on the adapter"""
|
||||
self._proxy.Powered = True
|
||||
logger.debug("Powered on adapter %s", self.name)
|
||||
self.reload()
|
||||
|
||||
def power_off(self):
|
||||
"""power off the adapter"""
|
||||
self._proxy.Powered = False
|
||||
logger.debug("Powered off adapter %s", self.name)
|
||||
self.reload()
|
||||
|
||||
def supports_mode(self, mode: str) -> bool:
|
||||
"""
|
||||
|
@ -99,7 +99,6 @@ def setup_devices(args):
|
||||
if not adhoc_adapter.is_powered_on():
|
||||
logger.debug("Adapter %s is off. Turning on", adhoc_adapter.name)
|
||||
adhoc_adapter.power_on()
|
||||
adhoc_device.reload()
|
||||
adhoc_device.start_adhoc_open(args.adhoc_name)
|
||||
# Start Access point if ap_device is not empty,
|
||||
# ie, we have more devices
|
||||
@ -113,11 +112,13 @@ def setup_devices(args):
|
||||
if not ap_adapter.is_powered_on():
|
||||
logger.debug("Adapter %s is off. Turning on", ap_adapter.name)
|
||||
ap_adapter.power_on()
|
||||
ap_adapter.reload()
|
||||
ap_device.start_ap(args.ap_ssid, args.ap_passwd)
|
||||
|
||||
# naxalnet prints Bye if no errors occured
|
||||
logger.info("Bye")
|
||||
else:
|
||||
logger.info("Not setting up WiFi AP.")
|
||||
else:
|
||||
logger.warning(
|
||||
"No device found to setup mesh. Make sure a WiFi adapter is connected"
|
||||
)
|
||||
|
||||
|
||||
def print_wifi(args):
|
||||
@ -161,5 +162,5 @@ def here_be_dragons():
|
||||
except DBusError:
|
||||
logger.exception("Error while communicating with iwd")
|
||||
sys.exit(4)
|
||||
|
||||
logger.debug("Finished.")
|
||||
# naxalnet prints Bye if no errors occured
|
||||
logger.info("Bye")
|
||||
|
Loading…
x
Reference in New Issue
Block a user