class_docstr: The RankFilter class is a convenient filter that extends the Filter class in the Python logging module.
  The purpose is to control which log records are processed based on the rank in a distributed environment.
  
  Args:
      rank: the rank of the process in the torch.distributed. Default is None and then it will use dist.get_rank().
      filter_fn: an optional lambda function used as the filtering criteria.
          The default function logs only if the rank of the process is 0,
          but the user can define their own function to implement custom filtering logic.
class_docstr_tok: ["The","RankFilter","class","is","a","convenient","filter","that","extends","the","Filter","class","in","the","Python","logging","module",".","The","purpose","is","to","control","which","log","records","are","processed","based","on","the","rank","in","a","distributed","environment",".","Args",":","rank",":","the","rank","of","the","process","in","the","torch.distributed",".","Default","is","None","and","then","it","will","use","dist.get_rank","(",")",".","filter_fn",":","an","optional","lambda","function","used","as","the","filtering","criteria",".","The","default","function","logs","only","if","the","rank","of","the","process","is","0",",","but","the","user","can","define","their","own","function","to","implement","custom","filtering","logic","."]
code: def filter(self, *_args):
      return self.filter_fn(self.rank)
  
file_path: MONAI/monai/utils/dist.py
imports: from __future__ import annotations
  import sys
  import warnings
  from collections.abc import Callable
  from logging import Filter
  from typing import overload
  import torch
  import torch.distributed
  from monai.config import IgniteInfo
  from monai.utils.module import min_version, optional_import
label_desc: Use image node_id 2 for calling the RankFilter obj's underlying member method code with example usage: obj.filter() and returns: self