diff --git a/dockerfiles/start.sh b/dockerfiles/start.sh
index 0cad0a04..e8e85ec0 100755
--- a/dockerfiles/start.sh
+++ b/dockerfiles/start.sh
@@ -7,15 +7,15 @@ echo "---------------------------------------------------------"
INSTALL_DIR=/home/pi # Specify the installation directory here
-# # if custom variables not set we do not need to do anything
-# if [ -n "${TZ}" ]; then
-# FILECONF=$INSTALL_DIR/pialert/config/pialert.conf
-# if [ -f "$FILECONF" ]; then
-# sed -ie "s|Europe/Berlin|${TZ}|g" $INSTALL_DIR/pialert/config/pialert.conf
-# else
-# sed -ie "s|Europe/Berlin|${TZ}|g" $INSTALL_DIR/pialert/back/pialert.conf_bak
-# fi
-# fi
+# if custom variables not set we do not need to do anything
+if [ -n "${TZ}" ]; then
+ FILECONF=$INSTALL_DIR/pialert/config/pialert.conf
+ if [ -f "$FILECONF" ]; then
+ sed -ie "s|Europe/Berlin|${TZ}|g" $INSTALL_DIR/pialert/config/pialert.conf
+ else
+ sed -ie "s|Europe/Berlin|${TZ}|g" $INSTALL_DIR/pialert/back/pialert.conf_bak
+ fi
+fi
# Check if script is run as root
if [[ $EUID -ne 0 ]]; then
diff --git a/dockerfiles/user-mapping.sh b/dockerfiles/user-mapping.sh
index 18c9024c..40dd4ec2 100755
--- a/dockerfiles/user-mapping.sh
+++ b/dockerfiles/user-mapping.sh
@@ -26,9 +26,10 @@ array=( ${LINE//:/ } )
USER_HOME=${array[4]}
# print debug output
-echo USER_ID: ${USER_ID};
-echo USER_GID: ${USER_GID};
+echo USER_ID : ${USER_ID};
+echo USER_GID : ${USER_GID};
echo USER_HOME: ${USER_HOME};
+echo TZ : ${TZ};
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:[0-9]*/${USER}:\1:${USER_ID}:${USER_GID}/" /etc/passwd
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json
index 2f589ffc..0af130a3 100755
--- a/front/php/templates/language/en_us.json
+++ b/front/php/templates/language/en_us.json
@@ -452,7 +452,7 @@
"run_event_tooltip" : "Enable the setting and save your changes at first before you run it.",
"run_event_icon" : "fa-play",
"general_event_title" : "Executing an ad-hoc event",
- "general_event_description" : " The event you nove triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the error log if you encounter issues).
Execution queue:",
+ "general_event_description" : "The event you nove triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the error log if you encounter issues).
Execution queue:",
"Plugins_Unprocessed_Events" : "Unprocessed Events",
"Plugins_Objects" : "Plugin Objects",
"Plugins_DeleteAll" : "Delete all (filters are ignored)",
diff --git a/front/plugins/_publisher_apprise/apprise.py b/front/plugins/_publisher_apprise/apprise.py
index 32c026b7..204b22d9 100755
--- a/front/plugins/_publisher_apprise/apprise.py
+++ b/front/plugins/_publisher_apprise/apprise.py
@@ -30,7 +30,7 @@ def main():
# Check if basic config settings supplied
if check_config() == False:
- mylog('none', [f'[{pluginName}] Error: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
return
# Create a database connection
diff --git a/front/plugins/_publisher_email/email_smtp.py b/front/plugins/_publisher_email/email_smtp.py
index 0b684655..40be1642 100755
--- a/front/plugins/_publisher_email/email_smtp.py
+++ b/front/plugins/_publisher_email/email_smtp.py
@@ -38,7 +38,7 @@ def main():
# Check if basic config settings supplied
if check_config() == False:
- mylog('none', [f'[{pluginName}] Error: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
return
# Create a database connection
@@ -82,7 +82,7 @@ def check_config ():
report_from = get_setting_value("SMTP_REPORT_FROM")
if server == '' or report_from == '' or report_to == '':
- mylog('none', ['[Email Check Config] Error: Email service not set up correctly. Check your pialert.conf SMTP_*, SMTP_REPORT_FROM and SMTP_REPORT_TO variables.'])
+ mylog('none', ['[Email Check Config] ⚠ ERROR: Email service not set up correctly. Check your pialert.conf SMTP_*, SMTP_REPORT_FROM and SMTP_REPORT_TO variables.'])
return False
else:
return True
diff --git a/front/plugins/_publisher_mqtt/mqtt.py b/front/plugins/_publisher_mqtt/mqtt.py
index 3b1bc47f..1e26dba7 100755
--- a/front/plugins/_publisher_mqtt/mqtt.py
+++ b/front/plugins/_publisher_mqtt/mqtt.py
@@ -51,7 +51,7 @@ def main():
# Check if basic config settings supplied
if check_config() == False:
- mylog('none', [f'[{pluginName}] Error: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
return
# Create a database connection
@@ -70,7 +70,7 @@ def main():
#-------------------------------------------------------------------------------
def check_config():
if get_setting_value('MQTT_BROKER') == '' or get_setting_value('MQTT_PORT') == '' or get_setting_value('MQTT_USER') == '' or get_setting_value('MQTT_PASSWORD') == '':
- mylog('none', ['[Check Config] Error: MQTT service not set up correctly. Check your pialert.conf MQTT_* variables.'])
+ mylog('none', ['[Check Config] ⚠ ERROR: MQTT service not set up correctly. Check your pialert.conf MQTT_* variables.'])
return False
else:
return True
diff --git a/front/plugins/_publisher_ntfy/ntfy.py b/front/plugins/_publisher_ntfy/ntfy.py
index 1d7945c8..dd97bbc0 100755
--- a/front/plugins/_publisher_ntfy/ntfy.py
+++ b/front/plugins/_publisher_ntfy/ntfy.py
@@ -33,7 +33,7 @@ def main():
# Check if basic config settings supplied
if check_config() == False:
- mylog('none', [f'[{pluginName}] Error: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
return
# Create a database connection
@@ -118,7 +118,7 @@ def send(html, text):
response_text = json.dumps(response.text)
except requests.exceptions.RequestException as e:
- mylog('none', [f'[{pluginName}] Error: ', e])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: ', e])
response_text = e
diff --git a/front/plugins/_publisher_pushsafer/pushsafer.py b/front/plugins/_publisher_pushsafer/pushsafer.py
index 9e35f98d..2059fbf4 100755
--- a/front/plugins/_publisher_pushsafer/pushsafer.py
+++ b/front/plugins/_publisher_pushsafer/pushsafer.py
@@ -32,7 +32,7 @@ def main():
# Check if basic config settings supplied
if check_config() == False:
- mylog('none', [f'[{pluginName}] Error: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
return
# Create a database connection
@@ -107,7 +107,7 @@ def send(text):
response_text = json.dumps(response.text)
except requests.exceptions.RequestException as e:
- mylog('none', [f'[{pluginName}] Error: ', e])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: ', e])
response_text = e
diff --git a/front/plugins/_publisher_webhook/webhook.py b/front/plugins/_publisher_webhook/webhook.py
index 8b66beee..f5e957f7 100755
--- a/front/plugins/_publisher_webhook/webhook.py
+++ b/front/plugins/_publisher_webhook/webhook.py
@@ -36,7 +36,7 @@ def main():
# Check if basic config settings supplied
if check_config() == False:
- mylog('none', [f'[{pluginName}] Error: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: Publisher notification gateway not set up correctly. Check your pialert.conf {pluginName}_* variables.'])
return
# Create a database connection
@@ -177,7 +177,7 @@ def send (text_data, html_data, json_data):
except subprocess.CalledProcessError as e:
# An error occurred, handle it
- mylog('none', [f'[{pluginName}] Error: ', e.output])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: ', e.output])
response_stderr = e.output
diff --git a/front/plugins/ddns_update/script.py b/front/plugins/ddns_update/script.py
index 05146a6e..989e5577 100755
--- a/front/plugins/ddns_update/script.py
+++ b/front/plugins/ddns_update/script.py
@@ -109,7 +109,7 @@ def get_dynamic_DNS_IP (DDNS_DOMAIN):
mylog('none', [f'[{pluginName}] DIG output :', dig_output])
except subprocess.CalledProcessError as e:
# An error occured, handle it
- mylog('none', [f'[{pluginName}] ERROR - ', e.output])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR - ', e.output])
dig_output = '' # probably no internet
# Check result is an IP
@@ -135,7 +135,7 @@ def set_dynamic_DNS_IP (DDNS_UPDATE_URL, DDNS_USER, DDNS_PASSWORD, DDNS_DOMAIN):
universal_newlines=True)
except subprocess.CalledProcessError as e:
# An error occured, handle it
- mylog('none', [f'[{pluginName}] ERROR - ',e.output])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR - ',e.output])
curl_output = ""
return curl_output
diff --git a/front/plugins/dhcp_leases/script.py b/front/plugins/dhcp_leases/script.py
index 93f527df..599c73ad 100755
--- a/front/plugins/dhcp_leases/script.py
+++ b/front/plugins/dhcp_leases/script.py
@@ -46,7 +46,7 @@ def get_entries(path, plugin_objects):
# Check if the path exists
if not os.path.exists(path):
- mylog('none', [f'[{pluginName}] Error: "{path}" does not exist.'])
+ mylog('none', [f'[{pluginName}] ⚠ ERROR: "{path}" does not exist.'])
else:
# Detect file encoding
with open(path, 'rb') as f:
diff --git a/front/plugins/nmap_scan/script.py b/front/plugins/nmap_scan/script.py
index 64ff3747..009bee38 100755
--- a/front/plugins/nmap_scan/script.py
+++ b/front/plugins/nmap_scan/script.py
@@ -119,7 +119,7 @@ def performNmapScan(deviceIPs, deviceMACs, timeoutSec, args):
except subprocess.CalledProcessError as e:
# An error occured, handle it
mylog('none', ["[NMAP Scan] " ,e.output])
- mylog('none', ["[NMAP Scan] Error - Nmap Scan - check logs", progress])
+ mylog('none', ["[NMAP Scan] ⚠ ERROR - Nmap Scan - check logs", progress])
except subprocess.TimeoutExpired as timeErr:
mylog('verbose', ['[NMAP Scan] Nmap TIMEOUT - the process forcefully terminated as timeout reached for ', ip, progress])
diff --git a/front/plugins/pholus_scan/script.py b/front/plugins/pholus_scan/script.py
index bd11687e..52bf89c8 100755
--- a/front/plugins/pholus_scan/script.py
+++ b/front/plugins/pholus_scan/script.py
@@ -150,7 +150,7 @@ def execute_pholus_on_interface(interface, timeoutSec, mask):
except subprocess.CalledProcessError as e:
# An error occured, handle it
mylog('none', ['[PHOLUS]', e.output])
- mylog('none', ["[PHOLUS] Error - Pholus Scan - check logs"])
+ mylog('none', ["[PHOLUS] ⚠ ERROR - Pholus Scan - check logs"])
except subprocess.TimeoutExpired as timeErr:
mylog('none', ['[PHOLUS] Pholus TIMEOUT - the process forcefully terminated as timeout reached'])
diff --git a/pialert/__main__.py b/pialert/__main__.py
index 0843fd0d..024f6aaf 100755
--- a/pialert/__main__.py
+++ b/pialert/__main__.py
@@ -187,8 +187,7 @@ def main ():
updateState("Process: Wait")
mylog('verbose', ['[MAIN] Process: Wait'])
else:
- # do something
- conf.cycle = ""
+ # do something
mylog('verbose', ['[MAIN] waiting to start next loop'])
#loop
diff --git a/pialert/api.py b/pialert/api.py
index 58721fab..ea627007 100755
--- a/pialert/api.py
+++ b/pialert/api.py
@@ -87,5 +87,5 @@ class api_endpoint_class:
# update hash
apiEndpoints[changedIndex].hash = self.hash
else:
- mylog('minimal', [f'[API] ERROR Updating {self.fileName}'])
+ mylog('minimal', [f'[API] ⚠ ERROR Updating {self.fileName}'])
diff --git a/pialert/appevent.py b/pialert/appevent.py
index 77af484c..a9a850a4 100755
--- a/pialert/appevent.py
+++ b/pialert/appevent.py
@@ -173,13 +173,13 @@ def getPluginObject(**kwargs):
return item
- mylog('debug', [f'[{module_name}] Error - Object not found - GUID:{GUID} | Plugin:{Plugin} | MAC:{MAC} | IP:{IP} | PrimaryID:{PrimaryID} | SecondaryID:{SecondaryID} | ForeignKey:{ForeignKey} | Index:{Index} | RowID:{RowID} '])
+ mylog('debug', [f'[{module_name}] ⚠ ERROR - Object not found - GUID:{GUID} | Plugin:{Plugin} | MAC:{MAC} | IP:{IP} | PrimaryID:{PrimaryID} | SecondaryID:{SecondaryID} | ForeignKey:{ForeignKey} | Index:{Index} | RowID:{RowID} '])
return None
except (FileNotFoundError, json.JSONDecodeError, ValueError) as e:
# Handle the case when the file is not found, JSON decoding fails, or data is not in the expected format
- mylog('none', [f'[{module_name}] Error - JSONDecodeError or FileNotFoundError for file {plugins_objects}'])
+ mylog('none', [f'[{module_name}] ⚠ ERROR - JSONDecodeError or FileNotFoundError for file {plugins_objects}'])
return None
diff --git a/pialert/device.py b/pialert/device.py
index 8ef31642..f6492c87 100755
--- a/pialert/device.py
+++ b/pialert/device.py
@@ -172,7 +172,7 @@ def create_new_devices (db):
FROM CurrentScan"""
- # mylog('debug',f'[New Devices] Create devices SQL: {sqlQuery}')
+ mylog('debug',f'[New Devices] Create devices SQL: {sqlQuery}')
sql.execute (sqlQuery, (startTime, startTime) )
@@ -291,7 +291,7 @@ def update_devices_names (db):
# Try IP matching only
if newName == nameNotFound:
newName = resolve_device_name_pholus (device['dev_MAC'], device['dev_LastIP'], pholusResults, nameNotFound, True)
-
+
# count
if newName != nameNotFound:
foundPholus += 1
@@ -359,6 +359,6 @@ def query_MAC_vendor (pMAC):
return -1 # MAC address not found in the database
except FileNotFoundError:
- mylog('none', [f"[Vendor Check] Error: Vendors file {vendorsPath} not found."])
+ mylog('none', [f"[Vendor Check] ⚠ ERROR: Vendors file {vendorsPath} not found."])
return -1
diff --git a/pialert/helper.py b/pialert/helper.py
index c702c642..f41db7b2 100755
--- a/pialert/helper.py
+++ b/pialert/helper.py
@@ -23,12 +23,16 @@ from logger import mylog, logResult
#-------------------------------------------------------------------------------
# Get the current time in the current TimeZone
def timeNowTZ():
- if isinstance(conf.TIMEZONE, str):
- tz = pytz.timezone(conf.TIMEZONE)
+ if conf.tz:
+ return datetime.datetime.now(conf.tz).replace(microsecond=0)
else:
- tz = conf.TIMEZONE
+ return datetime.datetime.now().replace(microsecond=0)
+ # if isinstance(conf.TIMEZONE, str):
+ # tz = pytz.timezone(conf.TIMEZONE)
+ # else:
+ # tz = conf.TIMEZONE
- return datetime.datetime.now(tz).replace(microsecond=0)
+ # return datetime.datetime.now(tz).replace(microsecond=0)
def timeNow():
return datetime.datetime.now().replace(microsecond=0)
@@ -173,7 +177,7 @@ def initialiseFile(pathToCheck, defaultFile):
stdout, stderr = p.communicate()
if str(os.access(pathToCheck, os.R_OK)) == "False":
- mylog('none', ["[Setup] Error copying ("+defaultFile+") to ("+pathToCheck+"). Make sure the app has Read & Write access to the parent directory."])
+ mylog('none', ["[Setup] ⚠ ERROR copying ("+defaultFile+") to ("+pathToCheck+"). Make sure the app has Read & Write access to the parent directory."])
else:
mylog('none', ["[Setup] ("+defaultFile+") copied over successfully to ("+pathToCheck+")."])
@@ -182,7 +186,7 @@ def initialiseFile(pathToCheck, defaultFile):
except subprocess.CalledProcessError as e:
# An error occured, handle it
- mylog('none', ["[Setup] Error copying ("+defaultFile+"). Make sure the app has Read & Write access to " + pathToCheck])
+ mylog('none', ["[Setup] ⚠ ERROR copying ("+defaultFile+"). Make sure the app has Read & Write access to " + pathToCheck])
mylog('none', [e.output])
#-------------------------------------------------------------------------------
@@ -255,13 +259,13 @@ def get_setting(key):
if item.get("Code_Name") == key:
return item
- mylog('debug', [f'[Settings] Error - setting_missing - Setting not found for key: {key} in file {settingsFile}'])
+ mylog('debug', [f'[Settings] ⚠ ERROR - setting_missing - Setting not found for key: {key} in file {settingsFile}'])
return None
except (FileNotFoundError, json.JSONDecodeError, ValueError) as e:
# Handle the case when the file is not found, JSON decoding fails, or data is not in the expected format
- mylog('none', [f'[Settings] Error - JSONDecodeError or FileNotFoundError for file {settingsFile}'])
+ mylog('none', [f'[Settings] ⚠ ERROR - JSONDecodeError or FileNotFoundError for file {settingsFile}'])
return None
@@ -290,10 +294,14 @@ def get_setting_value(key):
value = str(set_value)
elif set_type in ['boolean', 'integer.checkbox']:
- value = True
+ value = False
- if set_value in ['false', 'False', 'FALSE', 0]:
- value = False
+ if isinstance(set_value, str) and set_value.lower() in ['true', '1']:
+ value = True
+ elif isinstance(set_value, int) and set_value == 1:
+ value = True
+ elif isinstance(set_value, bool):
+ value = set_value
elif set_type in ['integer.select', 'integer']:
value = int(set_value)
@@ -304,8 +312,8 @@ def get_setting_value(key):
# Assuming set_value is a JSON object in this case
value = json.loads(set_value)
else:
- mylog('none', [f'[SETTINGS] ERROR - set_type not handled:{set_type}'])
- mylog('none', [f'[SETTINGS] ERROR - setting json:{json.dumps(setting)}'])
+ mylog('none', [f'[SETTINGS] ⚠ ERROR - set_type not handled:{set_type}'])
+ mylog('none', [f'[SETTINGS] ⚠ ERROR - setting json:{json.dumps(setting)}'])
return value
@@ -378,7 +386,7 @@ def resolve_device_name_dig (pMAC, pIP):
except subprocess.CalledProcessError as e:
# An error occured, handle it
- mylog('none', ['[resolve_device_name_dig] ERROR: ', e.output])
+ mylog('none', ['[resolve_device_name_dig] ⚠ ERROR: ', e.output])
# newName = "Error - check logs"
return nameNotFound
@@ -693,7 +701,7 @@ def checkNewVersion():
text = url.text
data = json.loads(text)
except requests.exceptions.ConnectionError as e:
- mylog('minimal', ["[Version check] Error: Couldn't check for new release."])
+ mylog('minimal', ["[Version check] ⚠ ERROR: Couldn't check for new release."])
data = ""
# make sure we received a valid response and not an API rate limit exceeded message
diff --git a/pialert/initialise.py b/pialert/initialise.py
index 72ee2a82..197102a3 100755
--- a/pialert/initialise.py
+++ b/pialert/initialise.py
@@ -123,8 +123,7 @@ def importConfigs (db):
# TODO cleanup later ----------------------------------------------------------------------------------
# init all time values as we have timezone - all this shoudl be moved into plugin/plugin settings
- conf.time_started = datetime.datetime.now(conf.tz)
- conf.cycle = ""
+ conf.time_started = datetime.datetime.now(conf.tz)
conf.plugins_once_run = False
# timestamps of last execution times
diff --git a/pialert/logger.py b/pialert/logger.py
index 24e2f331..79baf166 100755
--- a/pialert/logger.py
+++ b/pialert/logger.py
@@ -20,10 +20,13 @@ def timeNowTZ():
#-------------------------------------------------------------------------------
+# More verbose as the numbers go up
debugLevels = [
('none', 0), ('minimal', 1), ('verbose', 2), ('debug', 3)
]
+currentLevel = 0
+
def mylog(requestedDebugLevel, n):
setLvl = 0
diff --git a/pialert/plugin.py b/pialert/plugin.py
index b939f177..b6e52041 100755
--- a/pialert/plugin.py
+++ b/pialert/plugin.py
@@ -53,7 +53,7 @@ class plugin_param:
if setTyp.endswith(item):
return json.dumps(setVal)
else:
- mylog('none', ['[Plugins] ERROR: Parameter not converted.'])
+ mylog('none', ['[Plugins] ⚠ ERROR: Parameter not converted.'])
# Get SQL result
@@ -213,7 +213,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
except subprocess.CalledProcessError as e:
# An error occured, handle it
mylog('none', [e.output])
- mylog('none', ['[Plugins] Error - enable LOG_LEVEL=debug and check logs'])
+ mylog('none', ['[Plugins] ⚠ ERROR - enable LOG_LEVEL=debug and check logs'])
except subprocess.TimeoutExpired as timeErr:
mylog('none', ['[Plugins] TIMEOUT - the process forcefully terminated as timeout reached'])
@@ -317,7 +317,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
# handle missing "function":"DB_PATH" setting
if set == None:
- mylog('none', ['[Plugins] Error: DB_PATH setting for plugin type sqlite-db-query missing.'])
+ mylog('none', ['[Plugins] ⚠ ERROR: DB_PATH setting for plugin type sqlite-db-query missing.'])
return pluginsState
fullSqlitePath = set["value"]
@@ -328,8 +328,8 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
sql.execute ("ATTACH DATABASE '"+ fullSqlitePath +"' AS EXTERNAL_"+plugin["unique_prefix"])
arr = db.get_sql_array (q)
except sqlite3.Error as e:
- mylog('none',[f'[Plugins] Error: DB_PATH setting ({fullSqlitePath}) for plugin {plugin["unique_prefix"]}. Did you mount it correctly?'])
- mylog('none',[f'[Plugins] Error: ATTACH DATABASE failed with SQL ERROR: ', e])
+ mylog('none',[f'[Plugins] ⚠ ERROR: DB_PATH setting ({fullSqlitePath}) for plugin {plugin["unique_prefix"]}. Did you mount it correctly?'])
+ mylog('none',[f'[Plugins] ⚠ ERROR: ATTACH DATABASE failed with SQL ERROR: ', e])
return pluginsState
for row in arr:
@@ -580,7 +580,7 @@ def process_plugin_events(db, plugin, pluginsState, plugEventsArr):
except Exception as e:
# Rollback the transaction in case of an error
conn.rollback()
- mylog('none', ['[Plugins] Error: ', e])
+ mylog('none', ['[Plugins] ⚠ ERROR: ', e])
raise e
# Perform database table mapping if enabled for the plugin
diff --git a/pialert/plugin_utils.py b/pialert/plugin_utils.py
index 2e4c6142..7e41ea46 100755
--- a/pialert/plugin_utils.py
+++ b/pialert/plugin_utils.py
@@ -114,7 +114,7 @@ def list_to_csv(arr):
return tmp
else:
- mylog('none', f'[{module_name}] ERROR Could not convert array: {arr}')
+ mylog('none', f'[{module_name}] ⚠ ERROR Could not convert array: {arr}')
@@ -218,13 +218,13 @@ def getPluginObject(keyValues):
if all_match:
return item
- mylog('verbose', [f'[{module_name}] Error - Object not found {json.dumps(keyValues)} '])
+ mylog('verbose', [f'[{module_name}] ⚠ ERROR - Object not found {json.dumps(keyValues)} '])
return {}
except (FileNotFoundError, json.JSONDecodeError, ValueError) as e:
# Handle the case when the file is not found, JSON decoding fails, or data is not in the expected format
- mylog('verbose', [f'[{module_name}] Error - JSONDecodeError or FileNotFoundError for file {plugins_objects}'])
+ mylog('verbose', [f'[{module_name}] ⚠ ERROR - JSONDecodeError or FileNotFoundError for file {plugins_objects}'])
return {}