code: def test_logerror(mocker, a, err):
      logger = logging.getLogger(__name__)
      spy = mocker.spy(logger, "exception")
  
      @logerror(logger=logger)
      def test_fn(a):
          return a[3]
  
      with pytest.raises(err):
          test_fn(a)
  
      assert spy.call_count == 1
  
file_path: gluon-nlp/tests/test_utils_misc.py
imports: import pytest
  import tempfile
  import os
  import logging
  import multiprocessing
  import functools
  from pathlib import Path
  import numpy
  import mxnet
  from gluonnlp.utils.misc import download, sha1sum, logging_config, get_mxnet_visible_ctx, logerror
label_desc: Use image node_id 8 for calling a global function with example usage: test_logerror(mocker, a, err) and returns: a