code: def test_log_filter(self):
      def do_logging():
          for i in range(5):
              self.logger.warning("Log %s", i)
              self.logger.warning("Another log %s", i)
  
      # no filter
      with self.reset_logger():
          do_logging()
          self.assertEqual(
              self.handler.count_logs("Log \\d", logging.WARNING), 5
          )
          self.assertEqual(
              self.handler.count_logs(
                  "Another log \\d", logging.WARNING
              ),
              5,
          )
  
      # filter by template
      with self.reset_logger():
          log.LimitFilter._ignore.add((logging.WARNING, "Log %s"))
          do_logging()
          self.assertEqual(
              self.handler.count_logs("Log \\d", logging.WARNING), 0
          )
          self.assertEqual(
              self.handler.count_logs(
                  "Another log \\d", logging.WARNING
              ),
              5,
          )
  
      # filter by exact message
      with self.reset_logger():
          log.LimitFilter._ignore.add((logging.WARNING, "Log 3"))
          do_logging()
          self.assertEqual(
              self.handler.count_logs("Log \\d", logging.WARNING), 4
          )
          self.assertEqual(
              self.handler.count_logs(
                  "Another log \\d", logging.WARNING
              ),
              5,
          )
  
      # filter by both
      with self.reset_logger():
          log.LimitFilter._ignore.add((logging.WARNING, "Log 3"))
          log.LimitFilter._ignore.add(
              (logging.WARNING, "Another log %s")
          )
          do_logging()
          self.assertEqual(
              self.handler.count_logs("Log \\d", logging.WARNING), 4
          )
          self.assertEqual(
              self.handler.count_logs(
                  "Another log \\d", logging.WARNING
              ),
              0,
          )
  
file_path: pelican/pelican/tests/test_log.py
imports: import logging
  import unittest
  from collections import defaultdict
  from contextlib import contextmanager
  from pelican import log
  from pelican.tests.support import LogCountHandler
label_desc: Use image node_id 5 for calling the TestLog obj's underlying member method code with example usage: obj.test_log_filter() without return types