mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-07-24 16:58:11 -07:00
Added option to log without timestamps
This commit is contained in:
committed by
Mark Qvist
parent
a5ca1ee41e
commit
b4e15503c1
@@ -458,6 +458,9 @@ class Reticulum:
|
|||||||
RNS.loglevel = 0
|
RNS.loglevel = 0
|
||||||
if RNS.loglevel > 7:
|
if RNS.loglevel > 7:
|
||||||
RNS.loglevel = 7
|
RNS.loglevel = 7
|
||||||
|
elif option == "logtimestamps":
|
||||||
|
value = self.config["logging"].as_bool(option)
|
||||||
|
RNS.logtimestamps = bool(value)
|
||||||
|
|
||||||
if "reticulum" in self.config:
|
if "reticulum" in self.config:
|
||||||
for option in self.config["reticulum"]:
|
for option in self.config["reticulum"]:
|
||||||
|
|||||||
@@ -262,6 +262,12 @@ instance_name = default
|
|||||||
|
|
||||||
loglevel = 4
|
loglevel = 4
|
||||||
|
|
||||||
|
# You can disable timestamp inclusion in logs. Useful if
|
||||||
|
# you want to use an external logging tool that provides
|
||||||
|
# its own timestamps or custom formatting.
|
||||||
|
|
||||||
|
# logtimestamps = no
|
||||||
|
|
||||||
|
|
||||||
# The interfaces section defines the physical and virtual
|
# The interfaces section defines the physical and virtual
|
||||||
# interfaces Reticulum will use to communicate on. This
|
# interfaces Reticulum will use to communicate on. This
|
||||||
|
|||||||
+3
-2
@@ -82,6 +82,7 @@ loglevel = LOG_NOTICE
|
|||||||
logfile = None
|
logfile = None
|
||||||
logdest = LOG_STDOUT
|
logdest = LOG_STDOUT
|
||||||
logcall = None
|
logcall = None
|
||||||
|
logtimestamps = True
|
||||||
logtimefmt = "%Y-%m-%d %H:%M:%S"
|
logtimefmt = "%Y-%m-%d %H:%M:%S"
|
||||||
logtimefmt_p = "%H:%M:%S.%f"
|
logtimefmt_p = "%H:%M:%S.%f"
|
||||||
compact_log_fmt = False
|
compact_log_fmt = False
|
||||||
@@ -127,8 +128,8 @@ def log(msg, level=3, _override_destination = False, pt=False):
|
|||||||
if loglevel >= level:
|
if loglevel >= level:
|
||||||
if pt: logstring = "["+precise_timestamp_str(time.time())+"] "+loglevelname(level)+" "+msg
|
if pt: logstring = "["+precise_timestamp_str(time.time())+"] "+loglevelname(level)+" "+msg
|
||||||
else:
|
else:
|
||||||
if not compact_log_fmt: logstring = "["+timestamp_str(time.time())+"] "+loglevelname(level)+" "+msg
|
if not compact_log_fmt: logstring = ("["+timestamp_str(time.time())+"] " if logtimestamps else "")+loglevelname(level)+" "+msg
|
||||||
else: logstring = "["+timestamp_str(time.time())+"] "+msg
|
else: logstring = ("["+timestamp_str(time.time())+"] " if logtimestamps else "")+msg
|
||||||
|
|
||||||
with logging_lock:
|
with logging_lock:
|
||||||
if (logdest == LOG_STDOUT or _always_override_destination or _override_destination):
|
if (logdest == LOG_STDOUT or _always_override_destination or _override_destination):
|
||||||
|
|||||||
Reference in New Issue
Block a user