Example #1
0
 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)]
Example #2
0
 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)]
Example #3
0
 def format(self, record):
     formatted = SysLogHandler.format(self, record)
     return ' '.join((self.app_name, formatted))