[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ Test run without
zLOG deprecation warnings.
Tres Seaver
tseaver at palladion.com
Sat Jun 24 17:41:38 EDT 2006
Log message for revision 68833:
Test run without zLOG deprecation warnings.
Changed:
U Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py
U Zope/branches/2.9/lib/python/Products/PageTemplates/PageTemplateFile.py
U Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/2.9/lib/python/Products/Transience/Transience.py
U Zope/branches/2.9/lib/python/ZServer/datatypes.py
-=-
Modified: Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2006-06-24 21:15:03 UTC (rev 68832)
+++ Zope/branches/2.9/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2006-06-24 21:41:35 UTC (rev 68833)
@@ -17,6 +17,7 @@
"""
import sys
+import logging
from cgi import escape
from urllib import quote
from random import randint
@@ -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
@@ -45,6 +45,7 @@
from OFS.event import ObjectWillBeRemovedEvent
import OFS.subscribers
+LOG = logging.getLogger('BTreeFolder2')
manage_addBTreeFolderForm = DTMLFile('folderAdd', globals())
@@ -191,8 +192,7 @@
% repr(key))
return 1
except AssertionError:
- LOG('BTreeFolder2', WARNING,
- 'Detected damage to %s. Fixing now.' % path,
+ LOG.warn( 'Detected damage to %s. Fixing now.' % path,
error=sys.exc_info())
try:
self._tree = OOBTree(self._tree)
@@ -201,11 +201,11 @@
mt_index[key] = OIBTree(value)
self._mt_index = mt_index
except:
- LOG('BTreeFolder2', ERROR, 'Failed to fix %s.' % path,
+ LOG.error('Failed to fix %s.' % path,
error=sys.exc_info())
raise
else:
- LOG('BTreeFolder2', INFO, 'Fixed %s.' % path)
+ LOG.info('Fixed %s.' % path)
return 0
Modified: Zope/branches/2.9/lib/python/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PageTemplates/PageTemplateFile.py 2006-06-24 21:15:03 UTC (rev 68832)
+++ Zope/branches/2.9/lib/python/Products/PageTemplates/PageTemplateFile.py 2006-06-24 21:41:35 UTC (rev 68833)
@@ -18,8 +18,9 @@
__version__ = '$Revision: 1.30 $'[11:-2]
import os, AccessControl
+import logging
+
from Globals import package_home, DevelopmentMode
-from zLOG import LOG, ERROR
from Shared.DC.Scripts.Script import Script
from Shared.DC.Scripts.Signature import FuncCode
from AccessControl import getSecurityManager
@@ -31,6 +32,8 @@
from App.config import getConfiguration
from OFS.SimpleItem import Item_w__name__
+LOG = logging.getLogger('PageTemplateFile')
+
class PageTemplateFile(Item_w__name__, Script, PageTemplate, Traversable):
"Zope wrapper for filesystem Page Template using TAL, TALES, and METAL"
@@ -146,8 +149,7 @@
self.pt_edit(text, t)
self._cook()
if self._v_errors:
- LOG('PageTemplateFile', ERROR, 'Error in template',
- '\n'.join(self._v_errors))
+ LOG.error('Error in template', '\n'.join(self._v_errors))
return
self._v_last_read = mtime
Modified: Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py 2006-06-24 21:15:03 UTC (rev 68832)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py 2006-06-24 21:41:35 UTC (rev 68833)
@@ -20,6 +20,7 @@
__version__='$Revision: 1.56 $'[11:-2]
import sys, os, traceback, re, marshal, new
+import logging
from Globals import DTMLFile, MessageDialog, package_home
import AccessControl, OFS, RestrictedPython
from Acquisition import aq_parent
@@ -33,10 +34,11 @@
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 = logging.getLogger('Script (Python)')
+
# Track the Python bytecode version
import imp
Python_magic = imp.get_magic()
@@ -209,7 +211,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 +440,7 @@
else:
self._makeFunction()
except:
- LOG(self.meta_type, ERROR, 'write failed', error=sys.exc_info())
+ LOG.error('write failed', error=sys.exc_info())
raise
def manage_FTPget(self):
Modified: Zope/branches/2.9/lib/python/Products/Transience/Transience.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/Transience/Transience.py 2006-06-24 21:15:03 UTC (rev 68832)
+++ Zope/branches/2.9/lib/python/Products/Transience/Transience.py 2006-06-24 21:41:35 UTC (rev 68833)
@@ -437,7 +437,7 @@
length = self._length() # XXX ReadConflictError hotspot
if self._limit and length >= self._limit:
- LOG('Transience', WARNING,
+ LOG.warning(
('Transient object container %s max subobjects '
'reached' % self.getId())
)
@@ -799,8 +799,7 @@
except (KeyError, AttributeError):
path = self.getPhysicalPath()
err = 'No such onAdd/onDelete method %s referenced via %s'
- LOG('Transience',
- WARNING,
+ LOG.warning(
err % (callback, '/'.join(path)),
error=sys.exc_info()
)
@@ -820,8 +819,7 @@
except:
# dont raise, just log
path = self.getPhysicalPath()
- LOG('Transience',
- WARNING,
+ LOG.warning(
'%s failed when calling %s in %s' % (name,callback,
'/'.join(path)),
error=sys.exc_info()
@@ -831,8 +829,7 @@
else:
err = '%s in %s attempted to call non-callable %s'
path = self.getPhysicalPath()
- LOG('Transience',
- WARNING,
+ LOG.warning(
err % (name, '/'.join(path), callback),
error=sys.exc_info()
)
Modified: Zope/branches/2.9/lib/python/ZServer/datatypes.py
===================================================================
--- Zope/branches/2.9/lib/python/ZServer/datatypes.py 2006-06-24 21:15:03 UTC (rev 68832)
+++ Zope/branches/2.9/lib/python/ZServer/datatypes.py 2006-06-24 21:41:35 UTC (rev 68833)
@@ -170,8 +170,9 @@
if password is None:
msg = ('Monitor server not started because no emergency user '
'exists.')
- import zLOG
- zLOG.LOG("Zope", zLOG.ERROR, msg)
+ import logging
+ logger = logging.getLogger('Zope')
+ logger.error(msg)
return
from ZServer.medusa.monitor import secure_monitor_server
return secure_monitor_server(hostname=self.host, port=self.port,
More information about the Zope-Checkins
mailing list