From e3314a3f45f67a80269bb0b00bb9da97bb8f8b0f Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 31 Jul 2023 14:24:49 +0200 Subject: [PATCH] Remove log filter after each message Otherwise repeated calls will keep adding the filter --- brian2/utils/logger.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/brian2/utils/logger.py b/brian2/utils/logger.py index 131d61e7e..15bd14e35 100644 --- a/brian2/utils/logger.py +++ b/brian2/utils/logger.py @@ -412,8 +412,11 @@ def _log(self, log_level, msg, name_suffix, once): the_logger = logging.getLogger(name) if self.filter_name: - the_logger.addFilter(RemoveBrian2Filter()) + filter = RemoveBrian2Filter() + the_logger.addFilter(filter) the_logger.log(LOG_LEVELS[log_level], msg) + if self.filter_name: + the_logger.removeFilter(filter) def diagnostic(self, msg, name_suffix=None, once=False): """