code: def log_json_stats(stats, output_dir=None):
      """
      Logs json stats.
      Args:
          stats (dict): a dictionary of statistical information to log.
      """
      stats = {
          k: decimal.Decimal("{:.5f}".format(v))
          if isinstance(v, float)
          else v
          for k, v in stats.items()
      }
      json_stats = simplejson.dumps(
          stats, sort_keys=True, use_decimal=True
      )
      logger = get_logger(__name__)
      logger.info("json_stats: {:s}".format(json_stats))
      if du.is_master_proc(du.get_world_size()) and output_dir:
          filename = os.path.join(output_dir, "json_stats.log")
          try:
              with pathmgr.open(
                  filename,
                  "a",
                  buffering=1024 if "://" in filename else -1,
              ) as f:
                  f.write("json_stats: {:s}\n".format(json_stats))
          except Exception:
              logger.info(
                  "Failed to write to json_stats.log: {}".format(
                      json_stats
                  )
              )
  
file_path: SlowFast/slowfast/utils/logging.py
imports: import atexit
  import builtins
  import decimal
  import functools
  import logging
  import os
  import sys
  import simplejson
  import slowfast.utils.distributed
  from slowfast.utils.env import pathmgr
label_desc: Use image node_id 5 for calling a global function with example usage: log_json_stats(stats, output_dir) without return types