code: def logging_config(
      folder: Optional[str] = None,
      name: Optional[str] = None,
      logger: logging.Logger = logging.root,
      level: int = logging.INFO,
      console_level: int = logging.INFO,
      console: bool = True,
      overwrite_handler: bool = False,
  ) -> str:
      """Config the logging module. It will set the logger to save to the specified file path.
  
      Parameters
      ----------
      folder
          The folder to save the log
      name
          Name of the saved
      logger
          The logger
      level
          Logging level
      console_level
          Logging level of the console log
      console
          Whether to also log to console
      overwrite_handler
          Whether to overwrite the existing handlers in the logger
  
      Returns
      -------
      folder
          The folder to save the log file.
      """
      if name is None:
          name = inspect.stack()[-1][1].split(".")[0]
      if folder is None:
          folder = os.path.join(os.getcwd(), name)
      if not os.path.exists(folder):
          os.makedirs(folder, exist_ok=True)
      need_file_handler = True
      need_console_handler = True
      # Check all loggers.
      if overwrite_handler:
          logger.handlers = []
      else:
          for handler in logger.handlers:
              if isinstance(handler, logging.StreamHandler):
                  need_console_handler = False
      logpath = os.path.join(folder, name + ".log")
      print("All Logs will be saved to {}".format(logpath))
      logger.setLevel(level)
      formatter = logging.Formatter(
          "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
      )
      if need_file_handler:
          logfile = logging.FileHandler(logpath)
          logfile.setLevel(level)
          logfile.setFormatter(formatter)
          logger.addHandler(logfile)
      if console and need_console_handler:
          # Initialze the console logging
          logconsole = logging.StreamHandler()
          logconsole.setLevel(console_level)
          logconsole.setFormatter(formatter)
          logger.addHandler(logconsole)
      return folder
  
imports: import argparse
  import os
  import sys
  import inspect
  import logging
  import warnings
  import functools
  import uuid
  from types import ModuleType
  from typing import Optional
  import numpy
  import hashlib
  import requests
  import itertools
  import random
  from .lazy_imports import try_import_boto3
  from mxnet.gluon.utils import replace_file
  import glob
label_desc: Use image node_id 6 for calling a global function with example usage: logging_config(folder, name, logger, level, console_level, console, overwrite_handler) and returns: folder