code: def _emit(self, severity: Event.Severity, message: str, **kwargs):
      # NOTE: Python logger is thread-safe,
      # so we don't need to protect it using locks.
      event = Event()
      event.event_id = get_event_id()
      event.timestamp = int(datetime.now().timestamp())
      event.message = message
      event.severity = severity
      # TODO(sang): Support event type & schema.
      event.label = ""
      event.source_type = self.source
      event.source_hostname = self.source_hostname
      event.source_pid = self.source_pid
      custom_fields = event.custom_fields
      with self.lock:
          for k, v in self.global_context.items():
              if v is not None and k is not None:
                  custom_fields[k] = v
      for k, v in kwargs.items():
          if v is not None and k is not None:
              custom_fields[k] = v
  
      self.logger.info(
          json.dumps(
              MessageToDict(
                  event,
                  including_default_value_fields=True,
                  preserving_proto_field_name=True,
                  use_integers_for_enums=False,
              )
          )
      )
  
      # Force flush so that we won't lose events
      self.logger.handlers[0].flush()
  
imports: import logging
  import pathlib
  import json
  import random
  import string
  import socket
  import os
  import threading
  from typing import Dict, Optional
  from datetime import datetime
  from google.protobuf.json_format import MessageToDict, Parse
  from ray.core.generated.event_pb2 import Event
label_desc: Use image node_id 9 for calling the EventLoggerAdapter obj's underlying member method code with example usage: obj._emit(severity, message) without return types