mirror of
https://github.com/munki/munki.git
synced 2026-05-03 02:40:32 -05:00
Break up large messages to syslog into 1000 character chunks. Addresses #583.
This commit is contained in:
@@ -519,7 +519,15 @@ def validateDateFormat(datetime_string):
|
||||
|
||||
def log(msg, logname=''):
|
||||
"""Generic logging function."""
|
||||
logging.info(msg) # noop unless configure_syslog() is called first.
|
||||
if len(msg) > 1000:
|
||||
# See http://bugs.python.org/issue11907 and RFC-3164
|
||||
# break up huge msg into chunks and send 1000 characters at a time
|
||||
msg_buffer = msg
|
||||
while msg_buffer:
|
||||
logging.info(msg_buffer[:1000])
|
||||
msg_buffer = msg_buffer[1000:]
|
||||
else:
|
||||
logging.info(msg) # noop unless configure_syslog() is called first.
|
||||
|
||||
# date/time format string
|
||||
formatstr = '%b %d %Y %H:%M:%S %z'
|
||||
|
||||
Reference in New Issue
Block a user