Skip to content

Commit

Permalink
Remove log filter after each message
Browse files Browse the repository at this point in the history
Otherwise repeated calls will keep adding the filter
  • Loading branch information
mstimberg committed Jul 31, 2023
1 parent 828a6ca commit e3314a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion brian2/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit e3314a3

Please sign in to comment.