class_docstr: Abstract file logger.
  
  Args:
          path (str): path to write logs to
          steps_before_flushing: (int): Number of steps to store in log before flushing
          log_all_ranks: (bool): Log all ranks if true, else log only on rank 0.
class_docstr_tok: ["Abstract","file","logger",".","Args",":","path","(","str",")",":","path","to","write","logs","to","steps_before_flushing",":","(","int",")",":","Number","of","steps","to","store","in","log","before","flushing","log_all_ranks",":","(","bool",")",":","Log","all","ranks","if","true",",","else","log","only","on","rank","0","."]
code: def __init__(
      self,
      path: str,
      steps_before_flushing: int,
      log_all_ranks: bool,
  ) -> None:
      self._path: str = path
      self._rank: int = get_global_rank()
      self._log_all_ranks = log_all_ranks
      self._log_buffer: OrderedDict[
          int, Dict[str, float]
      ] = OrderedDict()
      self._len_before_flush: int = 0
      self._steps_before_flushing: int = steps_before_flushing
  
      if self._rank == 0 or log_all_ranks:
          logger.info(f"Logging metrics to path: {path}")
      else:
          logger.debug(
              f"Not logging metrics on this host because host rank is {self._rank} != 0"
          )
      atexit.register(self.close)
  
file_path: tnt/torchtnt/utils/loggers/file.py
imports: import atexit
  import logging
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from time import monotonic
  from typing import Dict, Mapping
  from torchtnt.utils.distributed import get_global_rank
  from torchtnt.utils.loggers.logger import Scalar
  from torchtnt.utils.loggers.utils import scalar_to_float
label_desc: Use image node_id 1 to create a new FileLogger object from inherited base classes: ABC with example: obj = FileLogger(path, steps_before_flushing, log_all_ranks)