From 80703430da413166d4d3f9d444967adaee59c179 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 2 Jan 2011 14:45:58 -0800 Subject: mod_syslog: call syslog() once per line This will fix bug #350379. --- pym/portage/elog/mod_syslog.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'pym') diff --git a/pym/portage/elog/mod_syslog.py b/pym/portage/elog/mod_syslog.py index d385255b2..d71dab4f1 100644 --- a/pym/portage/elog/mod_syslog.py +++ b/pym/portage/elog/mod_syslog.py @@ -22,10 +22,11 @@ def process(mysettings, key, logentries, fulltext): continue for msgtype,msgcontent in logentries[phase]: msgtext = "".join(msgcontent) - msgtext = "%s: %s: %s" % (key, phase, msgtext) - if sys.hexversion < 0x3000000 and isinstance(msgtext, unicode): - # Avoid TypeError from syslog.syslog() - msgtext = msgtext.encode(_encodings['content'], - 'backslashreplace') - syslog.syslog(_pri[msgtype], msgtext) + for line in msgtext.splitlines(): + line = "%s: %s: %s" % (key, phase, line) + if sys.hexversion < 0x3000000 and isinstance(msgtext, unicode): + # Avoid TypeError from syslog.syslog() + line = line.encode(_encodings['content'], + 'backslashreplace') + syslog.syslog(_pri[msgtype], line) syslog.closelog() -- cgit v1.2.3-1-g7c22