class_docstr: Standard CSV logger.
  
  The fields are inferred from the first call to write() and any additional
  fields afterwards are ignored.
  
  TODO(jaslanides): Consider making this stateless/robust to preemption.
class_docstr_tok: ["Standard","CSV","logger",".","The","fields","are","inferred","from","the","first","call","to","write","(",")","and","any","additional","fields","afterwards","are","ignored",".","TODO","(","jaslanides",")",":","Consider","making","this","stateless\/robust","to","preemption","."]
docstr: Instantiates the logger.
  
  Args:
    directory_or_file: Either a directory path as a string, or a file TextIO
      object.
    label: Extra label to add to logger. This is added as a suffix to the
      directory.
    time_delta: Interval in seconds between which writes are dropped to
      throttle throughput.
    add_uid: Whether to add a UID to the file path. See `paths.process_path`
      for details.
    flush_every: Interval (in writes) between flushes.
docstr_tok: ["Instantiates","the","logger",".","Args",":","directory_or_file",":","Either","a","directory","path","as","a","string",",","or","a","file","TextIO","object",".","label",":","Extra","label","to","add","to","logger",".","This","is","added","as","a","suffix","to","the","directory",".","time_delta",":","Interval","in","seconds","between","which","writes","are","dropped","to","throttle","throughput",".","add_uid",":","Whether","to","add","a","UID","to","the","file","path",".","See","`","paths.process_path","`","for","details",".","flush_every",":","Interval","(","in","writes",")","between","flushes","."]
code: def __init__(
      self,
      directory_or_file: Union[str, TextIO] = "~/acme",
      label: str = "",
      time_delta: float = 0.0,
      add_uid: bool = True,
      flush_every: int = 30,
  ):
      """Instantiates the logger.
  
      Args:
        directory_or_file: Either a directory path as a string, or a file TextIO
          object.
        label: Extra label to add to logger. This is added as a suffix to the
          directory.
        time_delta: Interval in seconds between which writes are dropped to
          throttle throughput.
        add_uid: Whether to add a UID to the file path. See `paths.process_path`
          for details.
        flush_every: Interval (in writes) between flushes.
      """
  
      if flush_every <= 0:
          raise ValueError(
              f"`flush_every` must be a positive integer (got {flush_every})."
          )
  
      self._last_log_time = time.time() - time_delta
      self._time_delta = time_delta
      self._flush_every = flush_every
      self._add_uid = add_uid
      self._writer = None
      self._file_owner = False
      self._file = self._create_file(directory_or_file, label)
      self._writes = 0
      logging.info("Logging to %s", self.file_path)
  
file_path: acme/acme/utils/loggers/csv.py
imports: import csv
  import os
  import time
  from typing import TextIO, Union
  from absl import logging
  from acme.utils import paths
  from acme.utils.loggers import base
label_desc: Use image node_id 1 to create a new CSVLogger object from inherited base classes: base with example: obj = CSVLogger(directory_or_file, label, time_delta, add_uid, flush_every)