def METHOD_NAME(self, record):
    self.format(record)
    # Avoid typical config issues by overriding loggers behavior
    if record.channel.startswith("elasticapm.errors"):
        sys.stderr.write(to_unicode(record.message) + "\n")
        return
    try:
        return self._emit(record)
    except Exception:
        sys.stderr.write("Top level ElasticAPM exception caught - failed creating log record.\n")
        sys.stderr.write(to_unicode(record.message) + "\n")
        sys.stderr.write(traceback.format_exc() + "\n")
        try:
            self.client.capture("Exception")
        except Exception:
            pass