From f1ef7e7b78f66faca4037834f5b12f27e24d2074 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Sat, 9 Sep 2023 18:37:05 -0500 Subject: [PATCH] Updated logging endpoint and levels --- src/core/__builtins__.py | 4 ++-- src/core/routes/routes.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/__builtins__.py b/src/core/__builtins__.py index 454eaf0..c43b306 100644 --- a/src/core/__builtins__.py +++ b/src/core/__builtins__.py @@ -7,7 +7,7 @@ import threading # Application imports from core.utils import Logger -from core.utils import MessageHandler # Get simple message processor +from core.utils import MessageHandler class BuiltinsException(Exception): @@ -32,5 +32,5 @@ builtins.app_name = ':::APP TITLE:::' builtins.threaded = threaded_wrapper builtins.daemon_threaded = daemon_threaded_wrapper builtins.ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__)) -builtins.logger = Logger(f"{ROOT_FILE_PTH}/../logs", _ch_log_lvl=10, _fh_log_lvl=20).get_logger() +builtins.logger = Logger(f"{ROOT_FILE_PTH}/../logs", _ch_log_lvl=10, _fh_log_lvl=10).get_logger() builtins.json_message = MessageHandler() diff --git a/src/core/routes/routes.py b/src/core/routes/routes.py index a8afe42..369cac8 100644 --- a/src/core/routes/routes.py +++ b/src/core/routes/routes.py @@ -21,12 +21,12 @@ def home(): title='Error!', message='Must use GET request type...') -# NOTE: Yeah, not exactly 'logged' but mostly used with the terminal anyway. +# NOTE: Normaly should sanitize logs or remove PII, etc. @app.route('/log-client-exception', methods=['GET', 'POST']) def ui_failure_exception_tracker(): if request.method == 'POST': DATA = str(request.values['exception_data']).strip() - print(f"\n\n{DATA}") + logger.debug(DATA) return json_message.create("success", "UI Exception logged...") return json_message.create("danger", "Must use POST request type...")