Make sure we analyze the same logger instance in execution_logs()

This commit is contained in:
Orsiris de Jong 2023-11-29 22:25:07 +01:00
parent 5c62f7d07e
commit 6607d5e78a
13 changed files with 17 additions and 13 deletions

View file

@ -88,7 +88,11 @@ def execution_logs(start_time: datetime) -> None:
10 = debug, 20 = info, 30 = warning, 40 = error, 50 = critical
so "if 30 in logger._cache" checks if warning has been triggered
ATTENTION: logger._cache does only contain cache of current main, not modules, deprecated in favor of
ofunctions.ContextFilterWorstLevel
ofunctions.logger_utils.ContextFilterWorstLevel
ATTENTION: For ofunctions.logger_utils.ContextFilterWorstLevel will only check current logger instance
So using logger = getLogger("anotherinstance") will create a separate instance from the one we can inspect
Makes sense ;)
"""
end_time = datetime.utcnow()

View file

@ -52,7 +52,7 @@ except ImportError:
sys.exit(1)
logger = getLogger(__name__)
logger = getLogger()
# NPF-SEC-00003: Avoid password command divulgation
ENCRYPTED_OPTIONS = [

View file

@ -17,7 +17,7 @@ import i18n
from npbackup.path_helper import BASEDIR
logger = getLogger(__intname__)
logger = getLogger()
TRANSLATIONS_DIR = os.path.join(BASEDIR, "translations")

View file

@ -26,7 +26,7 @@ from npbackup.__main__ import __intname__ as NAME, __version__ as VERSION
from npbackup import configuration
logger = logging.getLogger(__intname__)
logger = logging.getLogger()
def metric_writer(

View file

@ -16,7 +16,7 @@ from npbackup.upgrade_client.upgrader import auto_upgrader, _check_new_version
from npbackup.__main__ import __version__ as npbackup_version
logger = getLogger(__intname__)
logger = getLogger()
def check_new_version(config_dict: dict) -> bool:

View file

@ -22,7 +22,7 @@ from npbackup.core.nuitka_helper import IS_COMPILED
if os.name == "nt":
from npbackup.windows.task import create_scheduled_task
logger = getLogger(__intname__)
logger = getLogger()
def ask_backup_admin_password(config_dict) -> bool:

View file

@ -42,7 +42,7 @@ from npbackup.core.i18n_helper import _t
from npbackup.core.upgrade_runner import run_upgrade, check_new_version
logger = getLogger(__intname__)
logger = getLogger()
# Let's use mutable to get a cheap way of transfering data from thread to main program
# There are no possible race conditions since we don't modifiy the data from anywhere outside the thread

View file

@ -22,7 +22,7 @@ import queue
from command_runner import command_runner
logger = getLogger(__intname__)
logger = getLogger()
# Arbitrary timeout for init / init checks.
# If init takes more than a minute, we really have a problem

View file

@ -16,7 +16,7 @@ import json
import requests
logger = getLogger(__intname__)
logger = getLogger()
class Requestor:

View file

@ -25,7 +25,7 @@ from npbackup.path_helper import CURRENT_DIR, CURRENT_EXECUTABLE
from npbackup.core.nuitka_helper import IS_COMPILED
from npbackup.__main__ import __version__ as npbackup_version
logger = getLogger(__intname__)
logger = getLogger()
UPGRADE_DEFER_TIME = 60 # Wait x seconds before we actually do the upgrade so current program could quit before being erased

View file

@ -17,7 +17,7 @@ import tempfile
from command_runner import command_runner
from npbackup.customization import PROGRAM_NAME
logger = getLogger(__intname__)
logger = getLogger()
# This is the path to a onefile executable binary

View file

@ -18,7 +18,7 @@ from logging import getLogger
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
config_file = os.path.join(ROOT_DIR, "upgrade_server.conf")
logger = getLogger(__intname__)
logger = getLogger()
def load_config(config_file: str = config_file):

View file

@ -39,7 +39,7 @@ else:
config_dict = configuration.load_config()
logger = getLogger(__intname__)
logger = getLogger()
def sha256sum_data(data):