[Zope-Checkins] SVN: Zope/trunk/ dprecated zLOG module

Andreas Jung andreas at andreas-jung.com
Sun Jan 8 05:12:16 EST 2006


Log message for revision 41189:
  dprecated zLOG module 
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/OFS/PropertyManager.py
  U   Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
  U   Zope/trunk/lib/python/Products/Transience/Transience.py
  U   Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
  U   Zope/trunk/lib/python/TAL/TALInterpreter.py
  U   Zope/trunk/lib/python/zLOG/__init__.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2006-01-08 09:27:48 UTC (rev 41188)
+++ Zope/trunk/doc/CHANGES.txt	2006-01-08 10:12:16 UTC (rev 41189)
@@ -26,6 +26,8 @@
 
     Features added
 
+      - deprecated the zLOG module. Use Pythons 'logging' module instead
+
       - PluginIndexes/TextIndex is deprecated. Use ZCTextIndex instead
 
       - the 'StructuredText' module is deprecated. Use zope.structuredtext

Modified: Zope/trunk/lib/python/OFS/PropertyManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/PropertyManager.py	2006-01-08 09:27:48 UTC (rev 41188)
+++ Zope/trunk/lib/python/OFS/PropertyManager.py	2006-01-08 10:12:16 UTC (rev 41189)
@@ -180,7 +180,6 @@
         # for selection and multiple selection properties
         # the value argument indicates the select variable
         # of the property
-
         self._wrapperCheck(value)
         if not self.valid_property_id(id):
             raise BadRequest, 'Invalid or duplicate property id'

Modified: Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py	2006-01-08 09:27:48 UTC (rev 41188)
+++ Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py	2006-01-08 10:12:16 UTC (rev 41189)
@@ -21,6 +21,7 @@
 from urllib import quote
 from random import randint
 from types import StringType
+from logging import getLogger
 
 import Globals
 from Globals import DTMLFile
@@ -35,7 +36,6 @@
 from AccessControl import getSecurityManager, ClassSecurityInfo
 from AccessControl.Permissions import access_contents_information, \
      view_management_screens
-from zLOG import LOG, INFO, ERROR, WARNING
 from Products.ZCatalog.Lazy import LazyMap
 from zope.event import notify
 from zope.app.container.contained import ObjectAddedEvent
@@ -46,6 +46,8 @@
 import OFS.subscribers
 
 
+LOG = getLogger('BTreeFolder2')
+
 manage_addBTreeFolderForm = DTMLFile('folderAdd', globals())
 
 def manage_addBTreeFolder(dispatcher, id, title='', REQUEST=None):
@@ -191,9 +193,8 @@
                             % repr(key))
             return 1
         except AssertionError:
-            LOG('BTreeFolder2', WARNING,
-                'Detected damage to %s. Fixing now.' % path,
-                error=sys.exc_info())
+            LOG.warn('Detected damage to %s. Fixing now.' % path,
+                     exc_info=sys.exc_info())
             try:
                 self._tree = OOBTree(self._tree)
                 mt_index = OOBTree()
@@ -201,11 +202,11 @@
                     mt_index[key] = OIBTree(value)
                 self._mt_index = mt_index
             except:
-                LOG('BTreeFolder2', ERROR, 'Failed to fix %s.' % path,
-                    error=sys.exc_info())
+                LOG.error('Failed to fix %s.' % path,
+                    exc_info=sys.exc_info())
                 raise
             else:
-                LOG('BTreeFolder2', INFO, 'Fixed %s.' % path)
+                LOG.info('Fixed %s.' % path)
             return 0
 
 

Modified: Zope/trunk/lib/python/Products/Transience/Transience.py
===================================================================
--- Zope/trunk/lib/python/Products/Transience/Transience.py	2006-01-08 09:27:48 UTC (rev 41188)
+++ Zope/trunk/lib/python/Products/Transience/Transience.py	2006-01-08 10:12:16 UTC (rev 41189)
@@ -40,7 +40,7 @@
 from AccessControl.SecurityManagement import newSecurityManager, \
      setSecurityManager
 from AccessControl.User import nobody
-from zLOG import LOG, WARNING, INFO
+from logging import getLogger
 
 from TransientObject import TransientObject
 from Fake import FakeIOBTree
@@ -59,6 +59,7 @@
 DEBUG = int(os.environ.get('Z_TOC_DEBUG', 0))
 
 _marker = []
+LOG = getLogger('Transience')
 
 def setStrict(on=''):
     """ Turn on assertions (which may cause conflicts) """
@@ -72,7 +73,7 @@
     for arg in args:
         sargs.append(str(arg))
     msg = ' '.join(sargs)
-    LOG('Transience', INFO, msg)
+    LOG.info(msg)
 
 constructTransientObjectContainerForm = HTMLFile(
     'dtml/addTransientObjectContainer', globals())

Modified: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2006-01-08 09:27:48 UTC (rev 41188)
+++ Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py	2006-01-08 10:12:16 UTC (rev 41189)
@@ -38,7 +38,6 @@
      import PluggableIndexInterface
 from Products.PluginIndexes.interfaces import IPluggableIndex
 from Products.PluginIndexes.TextIndex import Splitter
-from zLOG import LOG
 from zope.interface import implements
 
 from Catalog import Catalog, CatalogError

Modified: Zope/trunk/lib/python/TAL/TALInterpreter.py
===================================================================

Modified: Zope/trunk/lib/python/zLOG/__init__.py
===================================================================
--- Zope/trunk/lib/python/zLOG/__init__.py	2006-01-08 09:27:48 UTC (rev 41188)
+++ Zope/trunk/lib/python/zLOG/__init__.py	2006-01-08 10:12:16 UTC (rev 41189)
@@ -77,6 +77,8 @@
 somewhere else.
 
 """
+
+import warnings
 from EventLogger import log_write, log_time, severity_string
 from traceback import format_exception
 
@@ -131,6 +133,13 @@
                  error is reraised.
 
     """
+
+
+    warnings.warn('Using the zLOG module is deprecated (to be removed in '
+                  'Zope 2.12. Use the Python logging module instead.'
+                  DeprecationWarning,
+                  stacklevel=2) 
+
     log_write(subsystem, severity, summary, detail, error)
     if reraise and error:
         raise error[0], error[1], error[2]



More information about the Zope-Checkins mailing list