code: def preserve_log_state():
      prev_state = torch._logging._internal._get_log_state()
      torch._logging._internal._set_log_state(
          torch._logging._internal.LogState()
      )
      try:
          yield
      finally:
          torch._logging._internal._set_log_state(prev_state)
          torch._logging._internal._init_logs()
  
file_path: pytorch/torch/testing/_internal/logging_utils.py
imports: import torch._dynamo.test_case
  import unittest.mock
  import os
  import contextlib
  import torch._logging
  import torch._logging._internal
  from torch._dynamo.utils import LazyString
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: preserve_log_state() without return types