code: def enable_global_logging(enable: bool = True) -> None:
      """
      Let NNI to handle all logs. Useful for debugging.
  
      By default only NNI's logs are printed to stdout and saved to ``nni-experiments`` log files.
      The function will extend these settings to all modules' logs.
  
      Use ``enable_global_logging(False)`` to reverse it.
      The log level of root logger will not be reversed though.
      """
      global _global_logging_enabled, _root_logger
  
      if enable == _global_logging_enabled:
          return
  
      if enable:
          level = logging.getLogger("nni").getEffectiveLevel()
          logging.getLogger().setLevel(level)
  
      new_root = (
          logging.getLogger() if enable else logging.getLogger("nni")
      )
      for handler in _handlers.values():
          _root_logger.removeHandler(handler)
          new_root.addHandler(handler)
  
      _root_logger = new_root
      _global_logging_enabled = enable
  
imports: from __future__ import annotations
  import logging
  import sys
  from datetime import datetime
  from io import TextIOBase
  from logging import FileHandler, Formatter, Handler, LogRecord, Logger, StreamHandler
  from pathlib import Path
  import string
  from typing import Optional
  import colorama
  from .env_vars import dispatcher_env_vars, trial_env_vars
label_desc: Use image node_id 5 for calling a global function with example usage: enable_global_logging(enable) without return types