mod_syslog: call syslog() once per line
authorZac Medico <zmedico@gentoo.org>
Sun, 2 Jan 2011 22:45:58 +0000 (14:45 -0800)
committerZac Medico <zmedico@gentoo.org>
Sun, 2 Jan 2011 22:45:58 +0000 (14:45 -0800)
This will fix bug #350379.

pym/portage/elog/mod_syslog.py

index d385255b2b673b097900d7f20793a3c77a640a14..d71dab4f1b1a2da896d386b13990921d5d014a56 100644 (file)
@@ -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()