docstr: Add a FileHandler to logger that logs all messages to a file. If the logger had a MemoryHandler at
  self._handlers["memory_all"], those buffered messages are flushed to the new file, and the MemoryHandler is
  closed.
docstr_tok: ["Add","a","FileHandler","to","logger","that","logs","all","messages","to","a","file",".","If","the","logger","had","a","MemoryHandler","at","self._handlers","[","``","memory_all","''","]",",","those","buffered","messages","are","flushed","to","the","new","file",",","and","the","MemoryHandler","is","closed","."]
code: def add_file_handler(self, log_file):
      """Add a FileHandler to logger that logs all messages to a file. If the logger had a MemoryHandler at
      self._handlers["memory_all"], those buffered messages are flushed to the new file, and the MemoryHandler is
      closed."""
      if self._logger is None:
          raise RuntimeError(
              "Impossible to set handlers if the Logger is not predefined"
          )
  
      self._handlers["file"] = _logging.FileHandler(log_file)
      formatter = BaseNeMoFormatter
      self._handlers["file"].setFormatter(formatter())
      self._logger.addHandler(self._handlers["file"])
  
      if self._handlers.get("memory_all", None):
          self._handlers["memory_all"].setTarget(self._handlers["file"])
          self._handlers["memory_all"].close()  # flush and remove
          del self._handlers["memory_all"]
  
imports: import enum
  import logging
  import sys
  import threading
  import warnings
  from contextlib import contextmanager
  from logging.handlers import MemoryHandler
  from nemo.constants import NEMO_ENV_VARNAME_REDIRECT_LOGS_TO_STDERR, NEMO_ENV_VARNAME_TESTING
  from nemo.utils.env_var_parsing import get_envbool
  from nemo.utils.formatters.base import BaseNeMoFormatter, DebugNeMoFormatter
  from nemo.utils.get_rank import is_global_rank_zero
  from nemo.utils.metaclasses import Singleton
label_desc: Use image node_id 6 for calling the Logger obj's underlying member method code with example usage: obj.add_file_handler(log_file) without return types