class_docstr: Serve Logging Json Formatter
  
  The formatter will generate the json log format on the fly
  based on the field of record.
class_docstr_tok: ["Serve","Logging","Json","Formatter","The","formatter","will","generate","the","json","log","format","on","the","fly","based","on","the","field","of","record","."]
code: def __init__(
      self,
      component_name: str,
      component_id: str,
      component_type: Optional[ServeComponentType] = None,
  ):
      self.component_log_fmt = {
          SERVE_LOG_LEVEL_NAME: SERVE_LOG_RECORD_FORMAT[
              SERVE_LOG_LEVEL_NAME
          ],
          SERVE_LOG_TIME: SERVE_LOG_RECORD_FORMAT[SERVE_LOG_TIME],
      }
      if (
          component_type
          and component_type == ServeComponentType.REPLICA
      ):
          self.component_log_fmt[SERVE_LOG_DEPLOYMENT] = component_name
          self.component_log_fmt[SERVE_LOG_REPLICA] = component_id
      else:
          self.component_log_fmt[SERVE_LOG_COMPONENT] = component_name
          self.component_log_fmt[SERVE_LOG_COMPONENT_ID] = component_id
  
imports: import copy
  import json
  import logging
  import os
  from typing import Optional, Tuple
  import ray
  from ray.serve._private.common import ServeComponentType
  from ray.serve._private.constants import RAY_SERVE_ENABLE_CPU_PROFILING, RAY_SERVE_ENABLE_JSON_LOGGING, RAY_SERVE_ENABLE_MEMORY_PROFILING, SERVE_LOG_APPLICATION, SERVE_LOG_COMPONENT, SERVE_LOG_COMPONENT_ID, SERVE_LOG_DEPLOYMENT, SERVE_LOG_EXTRA_FIELDS, SERVE_LOG_LEVEL_NAME, SERVE_LOG_MESSAGE, SERVE_LOG_RECORD_FORMAT, SERVE_LOG_REPLICA, SERVE_LOG_REQUEST_ID, SERVE_LOG_ROUTE, SERVE_LOG_TIME, SERVE_LOGGER_NAME
  from ray.serve.schema import EncodingType, LoggingConfig
label_desc: Use image node_id 1 to create a new ServeJSONFormatter object from inherited base classes: logging with example: obj = ServeJSONFormatter(component_name, component_id, component_type)