Configure logging to syslog.

def log_to_syslog():
    """
    Configure logging to syslog.

    """
    # Get root logger
    rl = logging.getLogger()
    rl.setLevel('INFO')

    # Stderr gets critical messages (mostly config/setup issues)
    #   only when not daemonized
    stderr = logging.StreamHandler(stream=sys.stderr)
    stderr.setLevel(logging.CRITICAL)
    stderr.setFormatter(logging.Formatter(
        '%(asctime)s %(name)s: %(levelname)s %(message)s'))
    rl.addHandler(stderr)

    # All interesting data goes to syslog, using root logger's loglevel
    syslog = SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_MAIL)
    syslog.setFormatter(logging.Formatter(
        '%(name)s[%(process)d]: %(levelname)s %(message)s'))
    rl.addHandler(syslog)