[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ zLOG -> logging

Andreas Jung andreas at andreas-jung.com
Sun Jan 8 05:22:29 EST 2006


Log message for revision 41190:
  zLOG -> logging
  

Changed:
  U   Zope/trunk/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
  U   Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
  U   Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py
  U   Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py

-=-
Modified: Zope/trunk/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py	2006-01-08 10:12:16 UTC (rev 41189)
+++ Zope/trunk/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py	2006-01-08 10:22:28 UTC (rev 41190)
@@ -16,6 +16,7 @@
 """
 
 import time
+from logging import getLogger
 from datetime import date, datetime
 from datetime import tzinfo, timedelta
 from types import StringType, FloatType, IntType
@@ -28,7 +29,6 @@
 from Globals import DTMLFile
 from OFS.PropertyManager import PropertyManager
 from ZODB.POSException import ConflictError
-from zLOG import LOG, ERROR
 from zope.interface import implements
 
 from Products.PluginIndexes.common import safe_callable
@@ -36,6 +36,7 @@
 from Products.PluginIndexes.common.util import parseIndexRequest
 from Products.PluginIndexes.interfaces import IDateIndex
 
+LOG = getLogger('DateIndex')
 _marker = []
 
 ###############################################################################
@@ -144,10 +145,9 @@
                     except ConflictError:
                         raise
                     except:
-                        LOG('UnIndex', ERROR,
-                            ("Should not happen: ConvertedDate was there,"
-                             " now it's not, for document with id %s" %
-                             documentId))
+                        LOG.error("Should not happen: ConvertedDate was there,"
+                                  " now it's not, for document with id %s" %
+                                  documentId)
 
             if ConvertedDate is not _marker:
                 self.insertForwardIndexEntry( ConvertedDate, documentId )

Modified: Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py	2006-01-08 10:12:16 UTC (rev 41189)
+++ Zope/trunk/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py	2006-01-08 10:22:28 UTC (rev 41190)
@@ -19,9 +19,9 @@
 import re
 from cgi import escape
 from types import *
-
+from logging import getLogger
 from Globals import Persistent, DTMLFile
-from zLOG import LOG, ERROR
+
 from Acquisition import Implicit
 from OFS.SimpleItem import SimpleItem
 from BTrees.IOBTree import IOBTree
@@ -39,6 +39,7 @@
 
 from Lexicon import Lexicon
 
+LOG = getLogger('TextIndex')
 
 class Op:
     def __init__(self, name):
@@ -376,9 +377,8 @@
         for wid in wids:
             widScores = get(wid, None)
             if widScores is None:
-                LOG('TextIndex', ERROR,
-                    'unindex_object tried to unindex nonexistent'
-                    ' document, wid  %s, %s' % (i,wid))
+                LOG.error('unindex_object tried to unindex nonexistent'
+                          ' document, wid  %s, %s' % (i,wid))
                 continue
             if type(widScores) is TupleType:
                 del index[wid]
@@ -394,9 +394,8 @@
                     else:
                         del index[wid]
                 except (KeyError, IndexError, TypeError):
-                    LOG('TextIndex', ERROR,
-                        'unindex_object tried to unindex nonexistent'
-                        ' document %s' % str(i))
+                    LOG.error('unindex_object tried to unindex nonexistent'
+                              ' document %s' % str(i))
 
     def __getitem__(self, word):
         """Return an InvertedIndex-style result "list"

Modified: Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py	2006-01-08 10:12:16 UTC (rev 41189)
+++ Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py	2006-01-08 10:22:28 UTC (rev 41190)
@@ -20,6 +20,7 @@
 __version__='$Revision: 1.56 $'[11:-2]
 
 import sys, os, traceback, re, marshal, new
+from logging import getLogger
 from Globals import DTMLFile, MessageDialog, package_home
 import AccessControl, OFS, RestrictedPython
 from Acquisition import aq_parent
@@ -33,10 +34,12 @@
 from OFS.History import Historical, html_diff
 from OFS.Cache import Cacheable
 from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
-from zLOG import LOG, ERROR, INFO, PROBLEM
+
 from zExceptions import Forbidden
 import Globals
 
+LOG = getLogger('PythonScripts')
+
 # Track the Python bytecode version
 import imp
 Python_magic = imp.get_magic()
@@ -209,7 +212,7 @@
             getattr(self, 'Script_magic', None) != Script_magic):
             global _log_complaint
             if _log_complaint:
-                LOG(self.meta_type, INFO, _log_complaint)
+                LOG.info(_log_complaint)
                 _log_complaint = 0
             # Changes here won't get saved, unless this Script is edited.
             body = self._body.rstrip()
@@ -438,7 +441,7 @@
             else:
                 self._makeFunction()
         except:
-            LOG(self.meta_type, ERROR, 'write failed', error=sys.exc_info())
+            LOG.error('write failed', exc_info=sys.exc_info())
             raise
 
     def manage_FTPget(self):

Modified: Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py	2006-01-08 10:12:16 UTC (rev 41189)
+++ Zope/trunk/lib/python/Products/ZCatalog/ProgressHandler.py	2006-01-08 10:22:28 UTC (rev 41190)
@@ -15,12 +15,12 @@
 """
 
 import time, sys
-from zLOG import LOG, INFO
+from logging import getLogger
 
 from DateTime.DateTime import DateTime
-
 from Interface import Interface
 
+LOG = getLogger('ProgressHandler')
 
 class IProgressHandler(Interface):
     """ A handler to log progress informations for long running 
@@ -92,7 +92,7 @@
     __implements__ = IProgressHandler
 
     def output(self, text):
-        LOG(self._ident, INFO, text)
+        LOG.info(text)
 
 
 class FilelogHandler(StdoutHandler):



More information about the Zope-Checkins mailing list