Skip to content

Commit

Permalink
Respecting LOG_LEVEL in plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jokob-sk committed Dec 22, 2024
1 parent 96e6246 commit 7248e73
Show file tree
Hide file tree
Showing 48 changed files with 167 additions and 56 deletions.
6 changes: 3 additions & 3 deletions docs/PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Also consider decreasing the scanned subnet, e.g. from `/16` to `/24` if need be

# Store temporary files in memory

You can also store temporary files in application memory (`/app/api` and `/app/log` folders).
You can also store temporary files in application memory (`/app/api` and `/app/log` folders). See highlighted lines `` below.

```yaml
version: "3"
Expand All @@ -49,8 +49,8 @@ services:
# (optional) useful for debugging if you have issues setting up the container
- local/path/logs:/app/log
# (API: OPTION 1) use for performance
- type: tmpfs
target: /app/api
- type: tmpfs #
target: /app/api #
# (API: OPTION 2) use when debugging issues
# - local/path/api:/app/api
environment:
Expand Down
2 changes: 1 addition & 1 deletion front/js/settings_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ function generateFormHtml(set, overrideValue) {
id="${`${event}_${setKey}`}"
data-myparam-setkey="${setKey}"
data-myparam="${setKey}"
data-myparam-plugin="${setTypeObject.prefix || ''}"
data-myparam-plugin="${setKey.split('_')[0] || ''}"
data-myevent="${event}"
onclick="execute_settingEvent(this)">
<i title="${getString(event + "_event_tooltip")}" class="fa ${getString(event + "_event_icon")}"></i>
Expand Down
Empty file modified front/php/templates/language/ca_ca.json
100644 → 100755
Empty file.
Empty file modified front/php/templates/language/es_es.json
100644 → 100755
Empty file.
Empty file modified front/php/templates/language/fr_fr.json
100644 → 100755
Empty file.
Empty file modified front/php/templates/language/it_it.json
100644 → 100755
Empty file.
Empty file modified front/php/templates/language/ru_ru.json
100644 → 100755
Empty file.
Empty file modified front/php/templates/language/uk_ua.json
100644 → 100755
Empty file.
5 changes: 4 additions & 1 deletion front/plugins/__template/rename_me.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from plugin_utils import get_plugins_configs
from logger import mylog
from logger import mylog, Logger
from const import pluginsPath, fullDbPath, logPath
from helper import timeNowTZ, get_setting_value
from notification import write_notification
Expand All @@ -22,6 +22,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = '<unique_prefix>'

# Define the current path and log file paths
Expand Down
2 changes: 1 addition & 1 deletion front/plugins/__test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from const import apiPath, confFileName, logPath
from plugin_utils import getPluginObject
from plugin_helper import Plugin_Objects
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value, bytes_to_string, sanitize_string, cleanDeviceName
from notification import Notification_obj
from database import DB, get_device_stats
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_apprise/apprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import conf
from const import confFileName, logPath
from plugin_helper import Plugin_Objects
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from notification import Notification_obj
from database import DB
Expand All @@ -24,6 +24,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'APPRISE'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_email/email_smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import conf
from const import confFileName, logPath
from plugin_helper import Plugin_Objects
from logger import mylog, append_line_to_file, print_log
from logger import mylog, Logger, append_line_to_file, print_log
from helper import timeNowTZ, get_setting_value, hide_email
from notification import Notification_obj
from database import DB
Expand All @@ -33,6 +33,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'SMTP'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_mqtt/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from const import apiPath, confFileName, logPath
from plugin_utils import getPluginObject
from plugin_helper import Plugin_Objects
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value, bytes_to_string, sanitize_string, normalize_string
from notification import Notification_obj
from database import DB, get_device_stats
Expand All @@ -35,6 +35,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'MQTT'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_ntfy/ntfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import conf
from const import confFileName, logPath
from plugin_helper import Plugin_Objects, handleEmpty
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from notification import Notification_obj
from database import DB
Expand All @@ -27,6 +27,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'NTFY'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_pushover/pushover.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Objects, handleEmpty # noqa: E402
from logger import mylog # noqa: E402
from logger import mylog, Logger # noqa: E402
from helper import timeNowTZ, get_setting_value, hide_string # noqa: E402
from notification import Notification_obj # noqa: E402
from database import DB # noqa: E402
Expand All @@ -21,6 +21,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = "PUSHOVER"

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_pushsafer/pushsafer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import conf
from const import confFileName, logPath
from plugin_helper import Plugin_Objects, handleEmpty
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value, hide_string
from notification import Notification_obj
from database import DB
Expand All @@ -27,6 +27,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'PUSHSAFER'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_telegram/tg.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import conf
from const import confFileName, logPath
from plugin_helper import Plugin_Objects
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from notification import Notification_obj
from database import DB
Expand All @@ -24,6 +24,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'TELEGRAM'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/_publisher_webhook/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import conf
from const import logPath, confFileName
from plugin_helper import Plugin_Objects, handleEmpty
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value, hide_string, write_file
from notification import Notification_obj
from database import DB
Expand All @@ -30,6 +30,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'WEBHOOK'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/arp_scan/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from database import DB
from plugin_helper import Plugin_Object, Plugin_Objects, handleEmpty
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from const import logPath, applicationPath
import conf
Expand All @@ -24,6 +24,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'ARPSCAN'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/avahi_scan/avahi_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from plugin_utils import get_plugins_configs
from logger import mylog
from logger import mylog, Logger
from const import pluginsPath, fullDbPath, logPath
from helper import timeNowTZ, get_setting_value
from notification import write_notification
Expand All @@ -25,6 +25,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'AVAHISCAN'

# Define the current path and log file paths
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/csv_backup/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from const import logPath, applicationPath, fullDbPath
import conf
Expand All @@ -24,6 +24,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'CSVBCKP'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/db_cleanup/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from const import logPath, applicationPath, fullDbPath
import conf
Expand All @@ -24,6 +24,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'DBCLNP'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/ddns_update/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value, check_IP_format
from const import logPath, applicationPath, fullDbPath
import conf
Expand All @@ -27,6 +27,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'DDNS'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/dhcp_leases/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Object, Plugin_Objects, handleEmpty, is_mac
from logger import mylog
from logger import mylog, Logger
from dhcp_leases import DhcpLeases
from helper import timeNowTZ, get_setting_value
import conf
Expand All @@ -23,6 +23,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName= 'DHCPLSS'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/dhcp_servers/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Objects, Plugin_Object
from logger import mylog
from logger import mylog, Logger
from helper import timeNowTZ, get_setting_value
import conf
from pytz import timezone

# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

def main():

mylog('verbose', ['[DHCPSRVS] In script'])
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/freebox/freebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from plugin_utils import get_plugins_configs
from logger import mylog
from logger import mylog, Logger
from const import pluginsPath, fullDbPath, logPath
from helper import timeNowTZ, get_setting_value
from notification import write_notification
Expand All @@ -31,6 +31,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value("TIMEZONE"))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'FREEBOX'

# Define the current path and log file paths
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/icmp_scan/icmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, get_setting_value
from const import logPath, applicationPath, fullDbPath
from database import DB
Expand All @@ -30,6 +30,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'ICMP'

LOG_PATH = logPath + '/plugins'
Expand Down
5 changes: 4 additions & 1 deletion front/plugins/internet_ip/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])

from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
from logger import mylog, append_line_to_file
from logger import mylog, Logger, append_line_to_file
from helper import timeNowTZ, check_IP_format, get_setting_value
from const import logPath, applicationPath, fullDbPath
import conf
Expand All @@ -28,6 +28,9 @@
# Make sure the TIMEZONE for logging is correct
conf.tz = timezone(get_setting_value('TIMEZONE'))

# Make sure log level is initialized correctly
Logger(get_setting_value('LOG_LEVEL'))

pluginName = 'INTRNT'

LOG_PATH = logPath + '/plugins'
Expand Down
Loading

0 comments on commit 7248e73

Please sign in to comment.