How to make a “Warn” item in the log, a push notification or a text notification

I've been using this code. I set it up to send a simple warn or error received in the log so I know to take a look.