docstr: Custom loguru log message format for handling JSON (in record['extra'])
docstr_tok: ["Custom","loguru","log","message","format","for","handling","JSON","(","in","record","[","'extra","'","]",")"]
code: def format_record(self, record: loguru.Record) -> str:
      """
      Custom loguru log message format for handling JSON (in record['extra'])
      """
      format_string: str = self.config.LOGURU_FORMAT
  
      if record["extra"] is not None:
          for key in record["extra"].keys():
              record["extra"][key] = pformat(
                  record["extra"][key],
                  indent=2,
                  compact=False,
                  width=88,
              )
              format_string += "\n{extra[" + key + "]}"
  
      format_string += "<level>{exception}</level>\n"
  
      return format_string
  
file_path: PySyft/packages/grid/backend/grid/logger/handler.py
imports: from __future__ import annotations
  from functools import lru_cache
  import logging
  from pprint import pformat
  import sys
  import loguru
  from loguru import logger
  from .config import get_log_config
label_desc: Use image node_id 2 for calling the LogHandler obj's underlying member method code with example usage: obj.format_record(record) and returns: format_string