docstr: If capture is true, redirect all warnings to the logging package.
  If capture is False, ensure that warnings are not redirected to logging
  but to their original destinations.
docstr_tok: ["If","capture","is","true",",","redirect","all","warnings","to","the","logging","package",".","If","capture","is","False",",","ensure","that","warnings","are","not","redirected","to","logging","but","to","their","original","destinations","."]
code: def captureWarnings(self, capture):
      """
      If capture is true, redirect all warnings to the logging package.
      If capture is False, ensure that warnings are not redirected to logging
      but to their original destinations.
      """
  
      if self._logger is not None:
          if capture and self.old_warnings_showwarning is None:
              # Backup Method
              self.old_warnings_showwarning = warnings.showwarning
              warnings.showwarning = self._showwarning
  
          elif (
              not capture and self.old_warnings_showwarning is not None
          ):
              # Restore Method
              warnings.showwarning = self.old_warnings_showwarning
              self.old_warnings_showwarning = None
  
imports: import enum
  import logging
  import sys
  import threading
  import warnings
  from contextlib import contextmanager
  from logging.handlers import MemoryHandler
  from nemo.constants import NEMO_ENV_VARNAME_REDIRECT_LOGS_TO_STDERR, NEMO_ENV_VARNAME_TESTING
  from nemo.utils.env_var_parsing import get_envbool
  from nemo.utils.formatters.base import BaseNeMoFormatter, DebugNeMoFormatter
  from nemo.utils.get_rank import is_global_rank_zero
  from nemo.utils.metaclasses import Singleton
label_desc: Use image node_id 15 for calling the Logger obj's underlying member method code with example usage: obj.captureWarnings(capture) without return types