class_docstr: Experiment writer for CSVLogger.
  
  Args:
      log_dir: Directory for the experiment logs
docstr: Record metrics.
docstr_tok: ["Record","metrics","."]
code: def log_metrics(
      self, metrics_dict: Dict[str, float], step: Optional[int] = None
  ) -> None:
      """Record metrics."""
  
      def _handle_value(value: Union[Tensor, Any]) -> Any:
          if isinstance(value, Tensor):
              return value.item()
          return value
  
      if step is None:
          step = len(self.metrics)
  
      metrics = {k: _handle_value(v) for k, v in metrics_dict.items()}
      metrics["step"] = step
      self.metrics.append(metrics)
  
imports: import csv
  import logging
  import os
  from argparse import Namespace
  from typing import Any, Dict, List, Optional, Set, Union
  from torch import Tensor
  from typing_extensions import override
  from lightning.fabric.loggers.logger import Logger, rank_zero_experiment
  from lightning.fabric.utilities.cloud_io import _is_dir, get_filesystem
  from lightning.fabric.utilities.logger import _add_prefix
  from lightning.fabric.utilities.rank_zero import rank_zero_only, rank_zero_warn
  from lightning.fabric.utilities.types import _PATH
label_desc: Use image node_id 2 for calling the _ExperimentWriter obj's underlying member method code with example usage: obj.log_metrics(metrics_dict, step) and returns: value, value