docstr: Log an event with additional information from the request context.
  :param action: a name to identify the event
  :param object_ref: reference to the Python object that triggered this action
  :param log_to_statsd: whether to update statsd counter for the action
docstr_tok: ["Log","an","event","with","additional","information","from","the","request","context",".",":","param","action",":","a","name","to","identify","the","event",":","param","object_ref",":","reference","to","the","Python","object","that","triggered","this","action",":","param","log_to_statsd",":","whether","to","update","statsd","counter","for","the","action"]
code: def log_context(
      self,
      action: str,
      object_ref: str | None = None,
      log_to_statsd: bool = True,
  ) -> Iterator[Callable[..., None]]:
      """
      Log an event with additional information from the request context.
      :param action: a name to identify the event
      :param object_ref: reference to the Python object that triggered this action
      :param log_to_statsd: whether to update statsd counter for the action
      """
      payload_override = {}
      start = datetime.now()
      # yield a helper to add additional payload
      yield lambda **kwargs: payload_override.update(kwargs)
      duration = datetime.now() - start
  
      # take the action from payload_override else take the function param action
      action_str = payload_override.pop("action", action)
      self.log_with_context(
          action_str,
          duration,
          object_ref,
          log_to_statsd,
          **payload_override,
      )
  
imports: from __future__ import annotations
  import functools
  import inspect
  import json
  import logging
  import textwrap
  from abc import ABC, abstractmethod
  from collections.abc import Iterator
  from contextlib import contextmanager
  from datetime import datetime, timedelta
  from typing import Any, Callable, cast, Literal, TYPE_CHECKING
  from flask import current_app, g, request
  from flask_appbuilder.const import API_URI_RIS_KEY
  from sqlalchemy.exc import SQLAlchemyError
  from superset.extensions import stats_logger_manager
  from superset.utils.core import get_user_id, LoggerLevel
label_desc: Use image node_id 6 for calling the AbstractEventLogger obj's underlying member method code with example usage: obj.log_context(action, object_ref, log_to_statsd) without return types