From 1ee07e3ec97e5693861877c654596eaa7a49342b Mon Sep 17 00:00:00 2001 From: Dinis Cruz Date: Sat, 8 Jun 2024 17:44:49 +0100 Subject: [PATCH 1/2] couple minor improvements to Trace_Call --- osbot_utils/helpers/trace/Trace_Call.py | 5 +++-- osbot_utils/helpers/trace/Trace_Call__Handler.py | 2 +- osbot_utils/utils/Python_Logger.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osbot_utils/helpers/trace/Trace_Call.py b/osbot_utils/helpers/trace/Trace_Call.py index cf70e214..c45df3a4 100644 --- a/osbot_utils/helpers/trace/Trace_Call.py +++ b/osbot_utils/helpers/trace/Trace_Call.py @@ -11,7 +11,7 @@ def trace_calls(title = None , print_traces = True , show_locals = False, source_code = False , - ignore = None , include = None , show_path = False, duration_bigger_than = 0 , + ignore = None , include = None , show_path = False, duration_bigger_than = 0 , trace_depth=0, max_string = None , show_types = False, show_duration = False ,# show_caller = False , # todo: add back when show_caller is working again show_class = False, contains = None , show_internals = False, enabled = True , extra_data = False, show_lines = False, print_lines = False, show_types_padding = None , duration_padding=None): @@ -30,7 +30,8 @@ def wrapper(*args, **kwargs): capture_extra_data=extra_data, print_padding_parent_info= show_types_padding, print_padding_duration=duration_padding, print_lines_on_exit=print_lines, trace_enabled=enabled, - trace_capture_lines=show_lines or print_lines) + trace_capture_lines=show_lines or print_lines, + trace_up_to_depth=trace_depth) config = (Trace_Call__Config().update_from_kwargs (**config_kwargs)) diff --git a/osbot_utils/helpers/trace/Trace_Call__Handler.py b/osbot_utils/helpers/trace/Trace_Call__Handler.py index f82ba3f3..4115b37a 100644 --- a/osbot_utils/helpers/trace/Trace_Call__Handler.py +++ b/osbot_utils/helpers/trace/Trace_Call__Handler.py @@ -168,7 +168,7 @@ def should_capture(self, frame): capture = False for item in self.config.trace_ignore_start_with: # Check if the module should be ignored - if module.startswith(item): + if module.startswith(item) or func_name.startswith(item): capture = False break return capture diff --git a/osbot_utils/utils/Python_Logger.py b/osbot_utils/utils/Python_Logger.py index be2bf895..93b0b5e2 100644 --- a/osbot_utils/utils/Python_Logger.py +++ b/osbot_utils/utils/Python_Logger.py @@ -99,7 +99,8 @@ def manager_remove_logger(self): def setup(self, logger_name=None, log_level=None,add_console_logger=False, add_memory_logger=True): if logger_name: self.logger_name = logger_name - self.logger = logging.getLogger(self.logger_name) + if self.logger is None: + self.logger = logging.getLogger(self.logger_name) self.setup_log_methods() self.set_log_level(log_level) if add_console_logger: From c58d61776fdb42ea361b7c859d339bd55bf82371 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 8 Jun 2024 16:46:06 +0000 Subject: [PATCH 2/2] Update release badge and version file --- README.md | 2 +- osbot_utils/version | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa31f83c..abf91428 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Powerful Python util methods and classes that simplify common apis and tasks. -![Current Release](https://img.shields.io/badge/release-v1.24.0-blue) +![Current Release](https://img.shields.io/badge/release-v1.24.1-blue) [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils) diff --git a/osbot_utils/version b/osbot_utils/version index de8c3cf6..68d2b75a 100644 --- a/osbot_utils/version +++ b/osbot_utils/version @@ -1 +1 @@ -v1.24.0 +v1.24.1 diff --git a/pyproject.toml b/pyproject.toml index 88d99f96..7ff9a032 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "osbot_utils" -version = "v1.24.0" +version = "v1.24.1" description = "OWASP Security Bot - Utils" authors = ["Dinis Cruz "] license = "MIT"