From dcd1c4235cbced4e1747fd4604dcff0bca2e6268 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Tue, 6 Aug 2024 14:45:39 -0700 Subject: [PATCH] logMessages 2 Disk --- README.md | 2 +- config.template | 2 ++ modules/log.py | 3 ++- modules/settings.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e8b7124..76b3f7b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Along with network testing, this bot has a lot of other features, like simple ma The bot is also capable of using dual radio/nodes, so you can monitor two networks at the same time and send messages to nodes using the same `bbspost @nodeNumber #message` function. There is a small message board to fit in the constraints of Meshtastic for posting bulletin messages with `bbspost $subject #message`. -Store and forward-like message re-play with `messages`, and there is a repeater module for dual radio bots to cross post messages. +Store and forward-like message re-play with `messages`, and there is a repeater module for dual radio bots to cross post messages. Messages are also logged locally to disk. The bot can also be used to monitor a frequency and let you know when activity is seen. Using Hamlib to watch the S meter on a connected radio. You can send alerts to channels when a frequency is detected for 20 seconds within the thresholds set in config.ini diff --git a/config.template b/config.template index aab56b7..6168d84 100644 --- a/config.template +++ b/config.template @@ -39,6 +39,8 @@ StoreLimit = 3 zuluTime = True # wait time for URL requests URL_TIMEOUT = 10 +# logging to file of the non Bot messages +LogMessagesToFile = False [bbs] enabled = True diff --git a/modules/log.py b/modules/log.py index d6768fd..c30d307 100644 --- a/modules/log.py +++ b/modules/log.py @@ -58,4 +58,5 @@ file_handler.setFormatter(logging.Formatter(msgLogFormat)) # Add handlers to the logger logger.addHandler(stdout_handler) -msgLogger.addHandler(file_handler) +if log_messages_to_file: + msgLogger.addHandler(file_handler) diff --git a/modules/settings.py b/modules/settings.py index 2189db0..7c3b24a 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -72,6 +72,7 @@ try: bbsdb = config['bbs'].get('bbsdb', 'bbsdb.pkl') dad_jokes_enabled = config['general'].getboolean('DadJokes', False) store_forward_enabled = config['general'].getboolean('StoreForward', False) + log_messages_to_file = config['general'].getboolean('LogMessagesToFile', True) # default True config['general'].get('motd', MOTD) urlTimeoutSeconds = config['general'].getint('URL_TIMEOUT', 10) # default 10 seconds forecastDuration = config['general'].getint('DAYS_OF_WEATHER', 4) # default days of weather