code: def add_log_to_file(
      file_path: str, logger: Optional[logging.Logger] = None
  ):
      """
      Add a FileHandler to the logger so that it can log to a file
  
      Parameters
      ----------
      file_path: str
          File path to save the log
      logger: Optional[logging.Logger], default = None
          The log to add FileHandler.
          If not provided, will add to the default AG logger, `logging.getLogger('autogluon')`
      """
      if logger is None:
          logger = _logger_ag
      fh = logging.FileHandler(file_path)
      logger.addHandler(fh)
  
file_path: autogluon/common/src/autogluon/common/utils/log_utils.py
imports: import logging
  from typing import Optional
label_desc: Use image node_id 3 for calling a global function with example usage: add_log_to_file(file_path, logger) without return types