code: def emit(self, record):
      fmt_args = ", ".join(
          itertools.chain(
              (str(tree_map(self._fmt, a)) for a in record.args[0]),
              (
                  f"{k}={str(tree_map(self._fmt, v))}"
                  for k, v in record.args[1].items()
              ),
          )
      )
      fmt_rets = tree_map(
          functools.partial(self._fmt, with_type=True), record.args[2]
      )
      self.log_list.append(f"{fmt_rets} = {record.msg}({fmt_args})")
      if self.tracebacks_list is not None:
          self.tracebacks_list.append(record.traceback)
  
imports: import torch
  from torch.utils._pytree import tree_map
  from typing import Iterator, List, Optional
  import logging
  import contextlib
  import itertools
  from torch.utils._python_dispatch import TorchDispatchMode
  from torch.utils.weak import WeakTensorKeyDictionary
  import functools
  from torch._C._profiler import gather_traceback, symbolize_tracebacks
label_desc: Use image node_id 4 for calling the LoggingTensorHandler obj's underlying member method code with example usage: obj.emit(record) without return types