code: def test_exception_logger(self) -> None:
      with self.assertRaises(Exception):
          self._failed_broadcast_raise_exception()
  
      with self.assertLogs(_c10d_logger, level="DEBUG") as captured:
          self._failed_broadcast_not_raise_exception()
          error_msg_dict = json.loads(
              re.search("({.+})", captured.output[0])
              .group(0)
              .replace("'", '"')
          )
  
          self.assertEqual(len(error_msg_dict), 10)
  
          self.assertIn("pg_name", error_msg_dict.keys())
          self.assertEqual("None", error_msg_dict["pg_name"])
  
          self.assertIn("func_name", error_msg_dict.keys())
          self.assertEqual("broadcast", error_msg_dict["func_name"])
  
          self.assertIn("args", error_msg_dict.keys())
  
          self.assertIn("backend", error_msg_dict.keys())
          self.assertEqual("nccl", error_msg_dict["backend"])
  
          self.assertIn("nccl_version", error_msg_dict.keys())
          nccl_ver = torch.cuda.nccl.version()
          self.assertEqual(
              ".".join(str(v) for v in nccl_ver),
              error_msg_dict["nccl_version"],
          )
  
          # In this test case, group_size = world_size, since we don't have multiple processes on one node.
          self.assertIn("group_size", error_msg_dict.keys())
          self.assertEqual(
              str(self.world_size), error_msg_dict["group_size"]
          )
  
          self.assertIn("world_size", error_msg_dict.keys())
          self.assertEqual(
              str(self.world_size), error_msg_dict["world_size"]
          )
  
          self.assertIn("global_rank", error_msg_dict.keys())
          self.assertIn(
              str(dist.get_rank()), error_msg_dict["global_rank"]
          )
  
          # In this test case, local_rank = global_rank, since we don't have multiple processes on one node.
          self.assertIn("local_rank", error_msg_dict.keys())
          self.assertIn(
              str(dist.get_rank()), error_msg_dict["local_rank"]
          )
  
imports: import json
  import logging
  import os
  import re
  import sys
  import time
  from functools import partial, wraps
  import torch
  import torch.distributed
  from torch.distributed.c10d_logger import _c10d_logger, _exception_logger, _time_logger
  from torch.testing._internal.common_distributed import MultiProcessTestCase, TEST_SKIPS
  from torch.testing._internal.common_utils import run_tests, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 10 for calling the C10dErrorLoggerTest obj's underlying member method code with example usage: obj.test_exception_logger() without return types