class_docstr: This is a distributed event logger class essentially based on :class:`logging`.
  
  Args:
      name (str): The name of the logger.
  
  Note:
      The parallel_mode used in ``info``, ``warning``, ``debug`` and ``error``
      should be concluded in ``ParallelMode``. More details about ``ParallelMode`` could be found
      in `parallel_mode <https://github.com/hpcaitech/ColossalAI/blob/main/colossalai/context/parallel_mode.py>`_.
class_docstr_tok: ["This","is","a","distributed","event","logger","class","essentially","based","on",":","class",":","`","logging","`",".","Args",":","name","(","str",")",":","The","name","of","the","logger",".","Note",":","The","parallel_mode","used","in","``","info","``",",","``","warning","``",",","``","debug","``","and","``","error","``","should","be","concluded","in","``","ParallelMode","``",".","More","details","about","``","ParallelMode","``","could","be","found","in","`","parallel_mode","<","https",":","\/\/github.com\/hpcaitech\/ColossalAI\/blob\/main\/colossalai\/context\/parallel_mode.py",">","`","_","."]
code: def __init__(self, name):
      if name in DistributedLogger.__instances:
          raise Exception(
              "Logger with the same name has been created, you should use colossalai.logging.get_dist_logger"
          )
      else:
          handler = None
          formatter = logging.Formatter(
              "colossalai - %(name)s - %(levelname)s: %(message)s"
          )
          try:
              from rich.logging import RichHandler
  
              handler = RichHandler(
                  show_path=False, markup=True, rich_tracebacks=True
              )
              handler.setFormatter(formatter)
          except ImportError:
              handler = logging.StreamHandler()
              handler.setFormatter(formatter)
  
          self._name = name
          self._logger = logging.getLogger(name)
          self._logger.setLevel(logging.INFO)
          if handler is not None:
              self._logger.addHandler(handler)
          self._logger.propagate = False
  
          DistributedLogger.__instances[name] = self
      self.rank = dist.get_rank() if dist.is_initialized() else 0
  
file_path: colossalai/colossalai/logging/logger.py
imports: import inspect
  import logging
  from pathlib import Path
  from typing import List, Union
  import torch.distributed
label_desc: Use image node_id 2 to create a new DistributedLogger object  with example: obj = DistributedLogger(name)