Commit 8a854815 authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent 9d2ed629
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
############################################################################## ##############################################################################
from types import StringType, UnicodeType from types import StringType, UnicodeType
from logging import getLogger
from zLOG import LOG, ERROR
from BTrees.OOBTree import OOSet, difference from BTrees.OOBTree import OOSet, difference
from Globals import DTMLFile from Globals import DTMLFile
...@@ -22,6 +21,8 @@ from Products.PluginIndexes import PluggableIndex ...@@ -22,6 +21,8 @@ from Products.PluginIndexes import PluggableIndex
from Products.PluginIndexes.common.UnIndex import UnIndex from Products.PluginIndexes.common.UnIndex import UnIndex
from Products.PluginIndexes.common import safe_callable from Products.PluginIndexes.common import safe_callable
LOG = getLogger('Zope.KeywordIndex')
class KeywordIndex(UnIndex): class KeywordIndex(UnIndex):
__implements__ = (PluggableIndex.UniqueValueIndex, __implements__ = (PluggableIndex.UniqueValueIndex,
...@@ -121,7 +122,7 @@ class KeywordIndex(UnIndex): ...@@ -121,7 +122,7 @@ class KeywordIndex(UnIndex):
try: try:
del self._unindex[documentId] del self._unindex[documentId]
except KeyError: except KeyError:
LOG('UnKeywordIndex', ERROR, 'Attempt to unindex nonexistent' LOG.error('Attempt to unindex nonexistent'
' document id %s' % documentId) ' document id %s' % documentId)
......
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
# #
############################################################################## ##############################################################################
__version__ = '$Id: PathIndex.py,v 1.40 2004/01/24 15:48:38 andreasjung Exp $' __version__ = '$Id: PathIndex.py,v 1.41 2004/04/20 14:30:44 andreasjung Exp $'
from types import StringType, ListType, TupleType from types import StringType, ListType, TupleType
from logging import getLogger
from Globals import Persistent, DTMLFile from Globals import Persistent, DTMLFile
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
...@@ -21,13 +22,13 @@ from BTrees.IOBTree import IOBTree ...@@ -21,13 +22,13 @@ from BTrees.IOBTree import IOBTree
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
from BTrees.IIBTree import IITreeSet, IISet, intersection, union from BTrees.IIBTree import IITreeSet, IISet, intersection, union
from BTrees.Length import Length from BTrees.Length import Length
from zLOG import LOG, ERROR
from Products.PluginIndexes import PluggableIndex from Products.PluginIndexes import PluggableIndex
from Products.PluginIndexes.common.util import parseIndexRequest from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.common import safe_callable from Products.PluginIndexes.common import safe_callable
_marker = [] _marker = []
LOG = getLogger('Zope.PathIndex')
class PathIndex(Persistent, SimpleItem): class PathIndex(Persistent, SimpleItem):
""" A path index stores all path components of the physical """ A path index stores all path components of the physical
...@@ -124,8 +125,7 @@ class PathIndex(Persistent, SimpleItem): ...@@ -124,8 +125,7 @@ class PathIndex(Persistent, SimpleItem):
""" hook for (Z)Catalog """ """ hook for (Z)Catalog """
if not self._unindex.has_key(docid): if not self._unindex.has_key(docid):
LOG(self.__class__.__name__, ERROR, LOG.error('Attempt to unindex nonexistent document'
'Attempt to unindex nonexistent document'
' with id %s' % docid) ' with id %s' % docid)
return return
......
...@@ -11,16 +11,19 @@ ...@@ -11,16 +11,19 @@
# #
############################################################################## ##############################################################################
__version__ = '$Id: FilteredSet.py,v 1.7 2004/01/15 23:17:17 tseaver Exp $' __version__ = '$Id: FilteredSet.py,v 1.8 2004/04/20 14:30:45 andreasjung Exp $'
import sys
from logging import getLogger
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from BTrees.IIBTree import IITreeSet from BTrees.IIBTree import IITreeSet
from Persistence import Persistent from Persistence import Persistent
from Globals import DTMLFile from Globals import DTMLFile
from zLOG import WARNING,LOG
from RestrictedPython.Eval import RestrictionCapableEval from RestrictedPython.Eval import RestrictionCapableEval
import sys
LOG = getLogger('Zope.TopicIndex.FilteredSet')
class FilteredSetBase(Persistent): class FilteredSetBase(Persistent):
...@@ -29,20 +32,16 @@ class FilteredSetBase(Persistent): ...@@ -29,20 +32,16 @@ class FilteredSetBase(Persistent):
self.expr = expr self.expr = expr
self.clear() self.clear()
def clear(self): def clear(self):
self.ids = IITreeSet() self.ids = IITreeSet()
def index_object(self, documentId, obj): def index_object(self, documentId, obj):
raise RuntimeError,'index_object not defined' raise RuntimeError,'index_object not defined'
def unindex_object(self,documentId): def unindex_object(self,documentId):
try: self.ids.remove(documentId) try: self.ids.remove(documentId)
except KeyError: pass except KeyError: pass
def getId(self): def getId(self):
return self.id return self.id
...@@ -63,7 +62,6 @@ class FilteredSetBase(Persistent): ...@@ -63,7 +62,6 @@ class FilteredSetBase(Persistent):
__str__ = __repr__ __str__ = __repr__
class PythonFilteredSet(FilteredSetBase): class PythonFilteredSet(FilteredSetBase):
meta_type = 'PythonFilteredSet' meta_type = 'PythonFilteredSet'
...@@ -80,10 +78,8 @@ class PythonFilteredSet(FilteredSetBase): ...@@ -80,10 +78,8 @@ class PythonFilteredSet(FilteredSetBase):
except ConflictError: except ConflictError:
raise raise
except: except:
LOG('FilteredSet',WARNING,'eval() failed',\ LOG.warn('eval() failed Object: %s, expr: %s' %\
'Object: %s, expr: %s' % (o.getId(),self.expr),\ (o.getId(),self.expr), exc_info=sys.exc_info())
sys.exc_info())
def factory(f_id, f_type, expr): def factory(f_id, f_type, expr):
......
...@@ -11,11 +11,12 @@ ...@@ -11,11 +11,12 @@
# #
############################################################################## ##############################################################################
__version__ = '$Id: TopicIndex.py,v 1.17 2003/12/31 22:32:21 poster Exp $' __version__ = '$Id: TopicIndex.py,v 1.18 2004/04/20 14:30:45 andreasjung Exp $'
from logging import getLogger
from Globals import Persistent, DTMLFile from Globals import Persistent, DTMLFile
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from zLOG import ERROR, LOG
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
from BTrees.IIBTree import IITreeSet,intersection,union from BTrees.IIBTree import IITreeSet,intersection,union
...@@ -24,6 +25,7 @@ from Products.PluginIndexes import PluggableIndex ...@@ -24,6 +25,7 @@ from Products.PluginIndexes import PluggableIndex
from Products.PluginIndexes.common.util import parseIndexRequest from Products.PluginIndexes.common.util import parseIndexRequest
_marker = [] _marker = []
LOG = getLogger('Zope.TopicIndex')
class TopicIndex(Persistent, SimpleItem): class TopicIndex(Persistent, SimpleItem):
...@@ -69,8 +71,7 @@ class TopicIndex(Persistent, SimpleItem): ...@@ -69,8 +71,7 @@ class TopicIndex(Persistent, SimpleItem):
try: try:
fs.unindex_object(docid) fs.unindex_object(docid)
except KeyError: except KeyError:
LOG(self.__class__.__name__, ERROR, LOG.error('Attempt to unindex document'
'Attempt to unindex document'
' with id %s failed' % docid) ' with id %s failed' % docid)
return 1 return 1
......
...@@ -13,15 +13,15 @@ ...@@ -13,15 +13,15 @@
"""Simple column indices""" """Simple column indices"""
__version__='$Revision: 1.21 $'[11:-2] __version__='$Revision: 1.22 $'[11:-2]
import sys import sys
from cgi import escape from cgi import escape
from logging import getLogger
from types import StringType, ListType, IntType, TupleType from types import StringType, ListType, IntType, TupleType
from Globals import Persistent from Globals import Persistent
from Acquisition import Implicit from Acquisition import Implicit
from zLOG import LOG, ERROR
from BTrees.OOBTree import OOBTree, OOSet from BTrees.OOBTree import OOBTree, OOSet
from BTrees.IOBTree import IOBTree from BTrees.IOBTree import IOBTree
...@@ -32,8 +32,8 @@ import BTrees.Length ...@@ -32,8 +32,8 @@ import BTrees.Length
from Products.PluginIndexes.common.util import parseIndexRequest from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.common import safe_callable from Products.PluginIndexes.common import safe_callable
_marker = [] _marker = []
LOG = getLogger('Zope.UnIndex')
class UnIndex(Persistent, Implicit, SimpleItem): class UnIndex(Persistent, Implicit, SimpleItem):
"""UnIndex object interface""" """UnIndex object interface"""
...@@ -202,17 +202,16 @@ class UnIndex(Persistent, Implicit, SimpleItem): ...@@ -202,17 +202,16 @@ class UnIndex(Persistent, Implicit, SimpleItem):
try: self.__len__.change(-1) try: self.__len__.change(-1)
except AttributeError: pass # pre-BTrees-module instance except AttributeError: pass # pre-BTrees-module instance
except: except:
LOG(self.__class__.__name__, ERROR, LOG.error('%s: unindex_object could not remove '
('unindex_object could not remove '
'documentId %s from index %s. This ' 'documentId %s from index %s. This '
'should not happen.' 'should not happen.' % (self.__class__.__name__,
% (str(documentId), str(self.id))), '', str(documentId), str(self.id)),
sys.exc_info()) exc_info=sys.exc_info())
else: else:
LOG(self.__class__.__name__, ERROR, LOG.error('%s: unindex_object tried to retrieve set %s '
('unindex_object tried to retrieve set %s '
'from index %s but couldn\'t. This ' 'from index %s but couldn\'t. This '
'should not happen.' % (repr(entry), str(self.id)))) 'should not happen.' % (self.__class__.__name__,
repr(entry), str(self.id)))
def insertForwardIndexEntry(self, entry, documentId): def insertForwardIndexEntry(self, entry, documentId):
...@@ -269,8 +268,7 @@ class UnIndex(Persistent, Implicit, SimpleItem): ...@@ -269,8 +268,7 @@ class UnIndex(Persistent, Implicit, SimpleItem):
try: try:
del self._unindex[documentId] del self._unindex[documentId]
except: except:
LOG('UnIndex', ERROR, LOG.error('Should not happen: oldDatum was there, now its not,'
'Should not happen: oldDatum was there, now its not,'
'for document with id %s' % documentId) 'for document with id %s' % documentId)
if datum is not _marker: if datum is not _marker:
...@@ -312,7 +310,7 @@ class UnIndex(Persistent, Implicit, SimpleItem): ...@@ -312,7 +310,7 @@ class UnIndex(Persistent, Implicit, SimpleItem):
try: try:
del self._unindex[documentId] del self._unindex[documentId]
except: except:
LOG('UnIndex', ERROR, 'Attempt to unindex nonexistent document' LOG.error('Attempt to unindex nonexistent document'
' with id %s' % documentId) ' with id %s' % documentId)
def _apply_index(self, request, cid='', type=type): def _apply_index(self, request, cid='', type=type):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment