Is there a good handler for the #python `logging.handlers` stuff that sends messages via #libnotify? I tend to write CLI tools with a boilerplate I hacked out ages ago, that has some argparse defaults and then does this (somewhat compressed for brevity):
```python
if __name__ == "__main__":
import sys, logging, logging.handlers
args = parse_args()
mylogger = logging.getLogger(sys.argv[0])
if args.syslog or not sys.stdout.isatty():
handler = logging.handlers.SysLogHandler(address="/dev/log", facility=logging.handlers.SysLogHandler.LOG_DAEMON)
handler.setFormatter(logging.Formatter("%(name)s: %(levelname)s %(message)s"))
mylogger.addHandler(handler)
mylogger.setLevel(logging.WARNING - (args.verbose * 10))
else: # use the basic config when on terminal
logging.basicConfig(level=max(logging.WARNING - (args.verbose * 10), 0))
main_loop(args, mylogger)
```
So if it's run from cron, it'll go to syslog by default, but you can also just pass in like `--syslog` and it'll do that from the shell as well. I figure I kind of want `notify-send` messages sometimes too. Maybe always, maybe only for `CRITICAL` and above? #logging






