class_docstr: Simple logger for TensorBoard.
  
  On construction, the logger creates a new events file that logs
  will be written to.  If the environment variable `RANK` is defined,
  logger will only log if RANK = 0.
  
  Note:
      If using this logger with distributed training:
  
      - This logger should be constructed on all ranks
      - This logger can call collective operations
      - Logs will be written on rank 0 only
      - Logger must be constructed synchronously *after* initializing the distributed process group.
  
  Args:
      path (str): path to write logs to
      *args: Extra positional arguments to pass to SummaryWriter
      **kwargs: Extra keyword arguments to pass to SummaryWriter
  
  Examples::
  
      from torchtnt.utils.loggers import TensorBoardLogger
      logger = TensorBoardLogger(path="tmp/tb_logs")
      logger.log("accuracy", 23.56, 10)
      logger.close()
class_docstr_tok: ["Simple","logger","for","TensorBoard",".","On","construction",",","the","logger","creates","a","new","events","file","that","logs","will","be","written","to",".","If","the","environment","variable","`","RANK","`","is","defined",",","logger","will","only","log","if","RANK","=","0",".","Note",":","If","using","this","logger","with","distributed","training",":","-","This","logger","should","be","constructed","on","all","ranks","-","This","logger","can","call","collective","operations","-","Logs","will","be","written","on","rank","0","only","-","Logger","must","be","constructed","synchronously","*","after","*","initializing","the","distributed","process","group",".","Args",":","path","(","str",")",":","path","to","write","logs","to","*","args",":","Extra","positional","arguments","to","pass","to","SummaryWriter","*","*","kwargs",":","Extra","keyword","arguments","to","pass","to","SummaryWriter","Examples",":",":","from","torchtnt.utils.loggers","import","TensorBoardLogger","logger","=","TensorBoardLogger","(","path=","''","tmp\/tb_logs","''",")","logger.log","(","``","accuracy","''",",","23.56",",","10",")","logger.close","(",")"]
docstr: Add text data to summary.
  
  Args:
      name (string): tag name used to identify data
      data (string): string to save
      step (int): step value to record
docstr_tok: ["Add","text","data","to","summary",".","Args",":","name","(","string",")",":","tag","name","used","to","identify","data","data","(","string",")",":","string","to","save","step","(","int",")",":","step","value","to","record"]
code: def log_text(
      self: TensorBoardLogger, name: str, data: str, step: int
  ) -> None:
      """Add text data to summary.
  
      Args:
          name (string): tag name used to identify data
          data (string): string to save
          step (int): step value to record
      """
  
      if self._writer:
          self._writer.add_text(name, data, global_step=step)
  
imports: from __future__ import annotations
  import atexit
  import logging
  from typing import Any, Dict, List, Mapping, Optional, Union
  import torch.distributed
  from torch.utils.tensorboard import SummaryWriter
  from torchtnt.utils.distributed import get_global_rank, PGWrapper
  from torchtnt.utils.loggers.logger import MetricLogger, Scalar
label_desc: Use image node_id 7 for calling the TensorBoardLogger obj's underlying member method code with example usage: obj.log_text(name, data, step) without return types