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","."]
docstr: Log scalar data to file.
  
  Args:
      name (string): a unique name to group scalars
      data (float/int/Tensor): scalar data to log
      step (int): step value to record
docstr_tok: ["Log","scalar","data","to","file",".","Args",":","name","(","string",")",":","a","unique","name","to","group","scalars","data","(","float\/int\/Tensor",")",":","scalar","data","to","log","step","(","int",")",":","step","value","to","record"]
code: def log(self, name: str, data: Scalar, step: int) -> None:
      """Log scalar data to file.
  
      Args:
          name (string): a unique name to group scalars
          data (float/int/Tensor): scalar data to log
          step (int): step value to record
      """
  
      if self._rank == 0 or self._log_all_ranks:
          self._log_buffer.setdefault(step, {})[name] = scalar_to_float(
              data
          )
          self._log_buffer[step]["step"] = step
          self._log_buffer[step]["time"] = monotonic()
  
      if (
          len(self._log_buffer) - self._len_before_flush
          >= self._steps_before_flushing
      ):
          self.flush()
          self._len_before_flush = len(self._log_buffer)
  
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 4 for calling the FileLogger obj's underlying member method code with example usage: obj.log(name, data, step) without return types