From 1eb0b4fda5d994ae647170ed4544ad1e321bbd73 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 5 Oct 2024 01:14:29 -0700 Subject: [PATCH] stuff --- config.template | 2 +- install.sh | 4 ++++ logs/README.md | 22 ++++++++++++---------- modules/settings.py | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/config.template b/config.template index c5d89fa..1a2a432 100644 --- a/config.template +++ b/config.template @@ -58,7 +58,7 @@ urlTimeout = 10 # logging to file of the non Bot messages LogMessagesToFile = False # Logging of system messages to file -SyslogToFile = False +SyslogToFile = True [games] # if hop limit for the user exceeds this value, the message will be dropped diff --git a/install.sh b/install.sh index b66a2af..e107a69 100755 --- a/install.sh +++ b/install.sh @@ -5,6 +5,7 @@ cd "$(dirname "$0")" program_path=$(pwd) cp etc/pong_bot.tmp etc/pong_bot.service cp etc/mesh_bot.tmp etc/mesh_bot.service +cp etc/mesh_bot_reporting.tmp etc/mesh_bot_reporting.service printf "\nMeshing Around Installer\n" printf "\nThis script will install the Meshing Around bot and its dependencies works best in debian/ubuntu\n" @@ -90,14 +91,17 @@ read bot replace="s|/dir/|$program_path/|g" sed -i $replace etc/pong_bot.service sed -i $replace etc/mesh_bot.service +sed -i $replace etc/mesh_bot_reporting.service # set the correct user in the service file? whoami=$(whoami) replace="s|User=pi|User=$whoami|g" sed -i $replace etc/pong_bot.service sed -i $replace etc/mesh_bot.service +sed -i $replace etc/mesh_bot_reporting.service replace="s|Group=pi|Group=$whoami|g" sed -i $replace etc/pong_bot.service sed -i $replace etc/mesh_bot.service +sed -i $replace etc/mesh_bot_reporting.service sudo systemctl daemon-reload printf "\n service files updated\n" diff --git a/logs/README.md b/logs/README.md index bb25a44..60f5434 100644 --- a/logs/README.md +++ b/logs/README.md @@ -1,21 +1,23 @@ Logs will collect here. Reporting is via [etc/report_generator5.py](etc/report_generator5.py), run it from the etc/ working directory. The report_generator5 has newer feel and HTML5 coding. The index.html output is published in [../etc/www](../etc/www) - - Make sure to have `SyslogToFile = True` to use reporting! ‼️ - - serviceTimer templates for routine output + - Make sure to have `SyslogToFile = True` and default of DEBUG log level to fully enable reporting! ‼️ + - provided serviceTimer templates in etc/ + ![reportView](../etc/reporting.jpg) - -Logging messages to disk or Syslog to disk uses the python native logging function. Take a look at the [/modules/log.py](/modules/log.py) you can set the file logger for syslog to INFO for example to not log DEBUG messages to file log, or modify the stdOut level. +Logging messages to disk or 'Syslog' to disk uses the python native logging function. ``` [general] -# logging to file of the non Bot messages -LogMessagesToFile = True -# Logging of system messages to file +# logging to file of the non Bot messages only +LogMessagesToFile = False +# Logging of system messages to file, needed for reporting engine SyslogToFile = True ``` -Example to log to disk only INFO and higher (ignore DEBUG) + +To change the stdout (what you see on the console) logging level (default is DEBUG) see the following example, line is in [/modules/log.py](/modules/log.py) + ``` -*log.py -file_handler.setLevel(logging.INFO) # DEBUG used by default for system logs to disk example here shows INFO +# Set level for stdout handler +stdout_handler.setLevel(logging.INFO) ``` \ No newline at end of file diff --git a/modules/settings.py b/modules/settings.py index d0f3cc6..b1d0b37 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -97,8 +97,8 @@ try: publicChannel = config['general'].getint('defaultChannel', 0) # the meshtastic public channel ignoreDefaultChannel = config['general'].getboolean('ignoreDefaultChannel', False) zuluTime = config['general'].getboolean('zuluTime', False) # aka 24 hour time - log_messages_to_file = config['general'].getboolean('LogMessagesToFile', True) # default True - syslog_to_file = config['general'].getboolean('SyslogToFile', False) + log_messages_to_file = config['general'].getboolean('LogMessagesToFile', False) # default off + syslog_to_file = config['general'].getboolean('SyslogToFile', True) # default on urlTimeoutSeconds = config['general'].getint('urlTimeout', 10) # default 10 seconds store_forward_enabled = config['general'].getboolean('StoreForward', True) storeFlimit = config['general'].getint('StoreLimit', 3) # default 3 messages for S&F