Adjusted logging, added exception handler
This commit is contained in:
parent
bd74b33094
commit
5228d5659e
|
@ -1215,7 +1215,7 @@ class SidebandCore():
|
|||
else:
|
||||
if self.is_service:
|
||||
if debug:
|
||||
RNS.loglevel = 7
|
||||
RNS.loglevel = 6
|
||||
else:
|
||||
RNS.loglevel = 2
|
||||
return True
|
||||
|
@ -2382,6 +2382,7 @@ class SidebandCore():
|
|||
time.sleep(SidebandCore.SERVICE_JOB_INTERVAL)
|
||||
now = time.time()
|
||||
|
||||
try:
|
||||
if hasattr(self, "interface_local"):
|
||||
if self.interface_local != None:
|
||||
if self.interface_local.carrier_changed:
|
||||
|
@ -2407,6 +2408,12 @@ class SidebandCore():
|
|||
self.owner_service.take_locks()
|
||||
last_multicast_lock_check = now
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
exception_info = "".join(traceback.TracebackException.from_exception(e).format())
|
||||
RNS.log(f"An {str(type(e))} occurred while running interface checks: {str(e)}", RNS.LOG_ERROR)
|
||||
RNS.log(exception_info, RNS.LOG_ERROR)
|
||||
|
||||
announce_wanted = self.getstate("wants.announce")
|
||||
announce_attached_interface = None
|
||||
announce_delay = 0
|
||||
|
@ -2563,8 +2570,8 @@ class SidebandCore():
|
|||
lastsync = self.getpersistent("lxmf.lastsync")
|
||||
nextsync = lastsync+syncinterval
|
||||
|
||||
RNS.log("Last LXMF sync was "+RNS.prettytime(now-lastsync)+" ago", RNS.LOG_DEBUG)
|
||||
RNS.log("Next LXMF sync is "+("in "+RNS.prettytime(nextsync-now) if nextsync-now > 0 else "now"), RNS.LOG_DEBUG)
|
||||
RNS.log("Last LXMF sync was "+RNS.prettytime(now-lastsync)+" ago", RNS.LOG_EXTREME)
|
||||
RNS.log("Next LXMF sync is "+("in "+RNS.prettytime(nextsync-now) if nextsync-now > 0 else "now"), RNS.LOG_EXTREME)
|
||||
if now > nextsync:
|
||||
if self.request_lxmf_sync():
|
||||
RNS.log("Scheduled LXMF sync succeeded", RNS.LOG_DEBUG)
|
||||
|
@ -2592,8 +2599,8 @@ class SidebandCore():
|
|||
|
||||
scheduled = next_send-now; blocked = self.telemetry_send_blocked_until-now
|
||||
next_send_in = max(scheduled, blocked)
|
||||
RNS.log("Last telemetry send was "+RNS.prettytime(now-last_send_timebase)+" ago", RNS.LOG_DEBUG)
|
||||
RNS.log("Next telemetry send is "+("in "+RNS.prettytime(next_send_in) if next_send_in > 0 else "now"), RNS.LOG_DEBUG)
|
||||
RNS.log("Last telemetry send was "+RNS.prettytime(now-last_send_timebase)+" ago", RNS.LOG_EXTREME)
|
||||
RNS.log("Next telemetry send is "+("in "+RNS.prettytime(next_send_in) if next_send_in > 0 else "now"), RNS.LOG_EXTREME)
|
||||
|
||||
if now > last_send_timebase+send_interval and now > self.telemetry_send_blocked_until:
|
||||
RNS.log("Initiating telemetry send to collector", RNS.LOG_DEBUG)
|
||||
|
@ -2625,8 +2632,8 @@ class SidebandCore():
|
|||
request_interval = self.config["telemetry_request_interval"]
|
||||
next_request = last_request_timebase+request_interval
|
||||
|
||||
RNS.log("Last telemetry request was "+RNS.prettytime(now-last_request_timebase)+" ago", RNS.LOG_DEBUG)
|
||||
RNS.log("Next telemetry request is "+("in "+RNS.prettytime(next_request-now) if next_request-now > 0 else "now"), RNS.LOG_DEBUG)
|
||||
RNS.log("Last telemetry request was "+RNS.prettytime(now-last_request_timebase)+" ago", RNS.LOG_EXTREME)
|
||||
RNS.log("Next telemetry request is "+("in "+RNS.prettytime(next_request-now) if next_request-now > 0 else "now"), RNS.LOG_EXTREME)
|
||||
|
||||
if now > last_request_timebase+request_interval:
|
||||
RNS.log("Initiating telemetry request to collector", RNS.LOG_DEBUG)
|
||||
|
@ -2708,7 +2715,7 @@ class SidebandCore():
|
|||
def _reticulum_log_debug(self, debug=False):
|
||||
self.log_verbose = debug
|
||||
if self.log_verbose:
|
||||
selected_level = 7
|
||||
selected_level = 6
|
||||
else:
|
||||
selected_level = 2
|
||||
|
||||
|
@ -2718,7 +2725,7 @@ class SidebandCore():
|
|||
|
||||
def __start_jobs_immediate(self):
|
||||
if self.log_verbose:
|
||||
selected_level = 7
|
||||
selected_level = 6
|
||||
else:
|
||||
selected_level = 2
|
||||
|
||||
|
|
Loading…
Reference in New Issue