class_docstr: Attaches to the logging module and captures log messages for each test.
      
class_docstr_tok: ["Attaches","to","the","logging","module","and","captures","log","messages","for","each","test","."]
code: def pytest_sessionfinish(self):
      with self.live_logs_context():
          if self.log_cli_handler:
              self.log_cli_handler.set_when("sessionfinish")
          if self.log_file_handler is not None:
              try:
                  with catching_logs(
                      self.log_file_handler, level=self.log_file_level
                  ):
                      yield
              finally:
                  # Close the FileHandler explicitly.
                  # (logging.shutdown might have lost the weakref?!)
                  self.log_file_handler.close()
          else:
              yield
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import re
  from contextlib import contextmanager
  import py
  import six
  import pytest
  from _pytest.compat import dummy_context_manager
  from _pytest.config import create_terminal_writer
  from _pytest.pathlib import Path
label_desc: Use image node_id 15 for calling the LoggingPlugin obj's underlying member method code with example usage: obj.pytest_sessionfinish() without return types