How to alert admins if there is an error in a custom plugin?

How do you do this? :slight_smile:
Sorry if this sounds obtuse, I honestly searched quite a bit and can’t find anything about logging errors.
As far as I know, the system can automatically send an email if there is too much logging, so that would actually be sufficient for our case.

How do I post into the error log? Just raise an error? Or is there a specific Discourse.error class?