def format(self, record): """ prio_length is length of '<prio>' header which is attached to message before sending to syslog so we need to subtract it from max_length to guarantee that length of resulting message won't be greater than max_length """ prio_length = len('%d' % self.encodePriority(self.facility, self.mapPriority(record.levelname))) + 2 # 2 is length of angle brackets return SysLogHandler.format(self, record)[:(self.max_length - prio_length)]
def format(self, record): """ prio_length is length of '<prio>' header which is attached to message before sending to syslog so we need to subtract it from max_length to guarantee that length of resulting message won't be greater than max_length """ prio_length = len('%d' % self.encodePriority(self.facility, self.mapPriority(record.levelname))) + len('<>') return SysLogHandler.format(self, record)[:(self.max_length - prio_length)]
def format(self, record): formatted = SysLogHandler.format(self, record) return ' '.join((self.app_name, formatted))