Function for formatting content and logging to syslog

def logit(self, msg, pid, user, cname, priority=None):
        """Function for formatting content and logging to syslog"""

        if self.stream:
            print(msg, file=self.stream)
        elif priority == logging.WARNING:
            self.logger.warning("{0}[pid:{1}] user:{2}: WARNING - {3}".format(cname, pid, user, msg))
        elif priority == logging.ERROR:
            self.logger.error("{0}[pid:{1}] user:{2}: ERROR - {3}".format(cname, pid, user, msg))
        else:
            self.logger.info("{0}[pid:{1}] user:{2}: INFO - {3}".format(cname, pid, user, msg))