[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService - ErrorReportingService.py:1.13

Guido van Rossum guido@python.org
Thu, 19 Dec 2002 17:52:01 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService
In directory cvs.zope.org:/tmp/cvs-serv14472

Modified Files:
	ErrorReportingService.py 
Log Message:
Convert to logging module.


=== Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/ErrorReportingService.py 1.12 => 1.13 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/ErrorReportingService.py:1.12	Tue Dec 10 04:24:58 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ErrorReportingService/ErrorReportingService.py	Thu Dec 19 17:52:00 2002
@@ -22,7 +22,7 @@
 from thread import allocate_lock
 from Persistence import Persistent
 from types import StringTypes
-from zLOG import LOG, ERROR
+import logging
 from Zope.Exceptions.ExceptionFormatter import format_exception
 from Zope.ContextWrapper import ContextMethod
 from Zope.App.OFS.Services.ErrorReportingService.IErrorReportingService \
@@ -114,10 +114,9 @@
             # We'll ignore these errors, and print something
             # useful instead, but also log the error.
             except:
-                LOG('SiteError', ERROR,
+                logging.getLogger('SiteError').exception(
                     'Error in ErrorReportingService while getting a str '
-                    'representation of an object ',
-                    error=sys.exc_info())
+                    'representation of an object')
                 strv = '<unprintable %s object>' % (
                         str(type(info[1]).__name__)
                         )
@@ -150,13 +149,14 @@
     raising = ContextMethod(raising)
 
     def _do_copy_to_zlog(self, now, strtype, url, info):
+        # XXX info is unused; logging.exception() will call sys.exc_info()
         when = _rate_restrict_pool.get(strtype,0)
         if now > when:
             next_when = max(when,
                             now - _rate_restrict_burst*_rate_restrict_period)
             next_when += _rate_restrict_period
             _rate_restrict_pool[strtype] = next_when
-            LOG('SiteError', ERROR, str(url), error=info)
+            logging.getLogger('SiteError').exception(str(url))
 
     def getProperties(self):
         return {