code: def test_logger_with_errors(
      mock_telemetry, action, feature, x, y, kwargs
  ):
      _exception = "Failed to run function"
      flags = dict()
      function_arguments = dict({"x": x, "y": y})
      _action = action or "my_function"
  
      @SKLearnEvaluationLogger.log(feature=feature, action=action)
      def my_function(a, b, x=None, y=None, **kwargs):
          raise Exception(_exception)
  
      try:
          my_function(1, 2, x=x, y=y, **kwargs)
      except Exception:
          pass
  
      if len(kwargs) > 0:
          for key, value in kwargs.items():
              if key in SKLearnEvaluationLogger.flags():
                  flags[key] = value
  
      expected_metadata = dict(
          {
              "action": _action,
              "feature": feature,
              "args": function_arguments,
              "exception": _exception,
          }
      )
  
      if len(flags) > 0:
          expected_metadata["flags"] = flags
  
      mock_telemetry.assert_has_calls(
          [call("sklearn-evaluation-error", metadata=expected_metadata)]
      )
  
imports: import pytest
  from unittest.mock import Mock, call
  from ploomber_core.telemetry import telemetry
  from sklearn_evaluation.telemetry import SKLearnEvaluationLogger
label_desc: Use image node_id 3 for calling a global function with example usage: test_logger_with_errors(mock_telemetry, action, feature, x, y, kwargs) without return types