code: def _init_logs(log_file_name=None):
      _reset_logs()
      _update_log_state_from_env()
  
      out = os.environ.get(LOG_OUT_ENV_VAR, None)
      if out is not None:
          log_file_name = out
  
      # First, reset all known (registered) loggers to NOTSET, so that they
      # respect their parent log level
      for log_qname in log_registry.get_log_qnames():
          # But not the top level torch level: this defaults to WARNING so
          # that our log messages don't leak to the lower levels
          if log_qname == "torch":
              continue
          log = logging.getLogger(log_qname)
          log.setLevel(logging.NOTSET)
  
      # Now, for all loggers which the user requested to have non-standard
      # logging behavior, modify their log levels
      for log_qname, level in log_state.get_log_level_pairs():
          log = logging.getLogger(log_qname)
          log.setLevel(level)
  
      # Finally, setup handlers for all registered loggers
      for log_qname in log_registry.get_log_qnames():
          log = logging.getLogger(log_qname)
          _setup_handlers(
              logging.StreamHandler,
              log,
          )
  
          if log_file_name is not None:
              _setup_handlers(
                  lambda: logging.FileHandler(log_file_name),
                  log,
              )
  
      # configure artifact loggers, note: this must happen last
      # since the levels of ancestor loggers are taken into account
      for artifact_log_qname in log_registry.get_artifact_log_qnames():
          log = logging.getLogger(artifact_log_qname)
          configure_artifact_log(log)
  
imports: import functools
  import itertools
  import logging
  import os
  import re
  from dataclasses import dataclass, field
  from importlib import __import__
  from typing import Dict, List, Optional, Set, Union
  from weakref import WeakSet
  import torch._guards
  import torch.distributed
label_desc: Use image node_id 23 for calling a global function with example usage: _init_logs(log_file_name) without return types