class_docstr:     Args:
      Context manager to capture `logging` streams
          logger: 'logging` logger object
      Returns:
          The captured output is available via `self.out`
      Example:
      ```python
      >>> from diffusers import logging
      >>> from diffusers.testing_utils import CaptureLogger
  
      >>> msg = "Testing 1, 2, 3"
      >>> logging.set_verbosity_info()
      >>> logger = logging.get_logger("diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.py")
      >>> with CaptureLogger(logger) as cl:
      ...     logger.info(msg)
      >>> assert cl.out, msg + "
  "
      ```
      
class_docstr_tok: ["Args",":","Context","manager","to","capture","`","logging","`","streams","logger",":","'logging","`","logger","object","Returns",":","The","captured","output","is","available","via","`","self.out","`","Example",":","``","`","python",">",">",">","from","diffusers","import","logging",">",">",">","from","diffusers.testing_utils","import","CaptureLogger",">",">",">","msg","=","``","Testing","1",",","2",",","3","''",">",">",">","logging.set_verbosity_info","(",")",">",">",">","logger","=","logging.get_logger","(","``","diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.py","''",")",">",">",">","with","CaptureLogger","(","logger",")","as","cl",":","...","logger.info","(","msg",")",">",">",">","assert","cl.out",",","msg","+","``","''","``","`"]
code: def __init__(self, logger):
      self.logger = logger
      self.io = StringIO()
      self.sh = logging.StreamHandler(self.io)
      self.out = ""
  
imports: import functools
  import importlib
  import inspect
  import io
  import logging
  import multiprocessing
  import os
  import random
  import re
  import struct
  import sys
  import tempfile
  import time
  import unittest
  import urllib.parse
  from contextlib import contextmanager
  from distutils.util import strtobool
  from io import BytesIO, StringIO
  from pathlib import Path
  from typing import List, Optional, Union
  import numpy
  import PIL.Image
  import PIL.ImageOps
  import requests
  from numpy.linalg import norm
  from packaging import version
  from .import_utils import BACKENDS_MAPPING, is_compel_available, is_flax_available, is_note_seq_available, is_onnx_available, is_opencv_available, is_peft_available, is_torch_available, is_torch_version, is_torchsde_available, is_transformers_available
  from .logging import get_logger
label_desc: Use image node_id 1 to create a new CaptureLogger object  with example: obj = CaptureLogger(logger)