Skip to content

Commit

Permalink
Replace bulk of uses of 'zLOG' with equivalent Python 'logging' modul…
Browse files Browse the repository at this point in the history
…e usage.

Exceptions:

  - 'ZServer' code which uses the 'register_subsystem' stuff.

  - Code which imports custom log levels (BLATHER, TRACE), now pulled from
    'zLOG.EventLogger'.

  - Test jigs which play with zLOG's 'write_log'.

  - Usage in 'svn:externals' modules (ZODB, etc.)
  • Loading branch information
tseaver committed Jun 24, 2006
1 parent 3c4fcdc commit 18314a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions ProgressHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import time, sys
from zLOG import LOG, INFO
import logging

from DateTime.DateTime import DateTime

Expand Down Expand Up @@ -92,7 +92,8 @@ class ZLogHandler(StdoutHandler):
__implements__ = IProgressHandler

def output(self, text):
LOG(self._ident, INFO, text)
logger = logging.getLogger(self._ident)
logger.info(text)


class FilelogHandler(StdoutHandler):
Expand Down
18 changes: 9 additions & 9 deletions ZCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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
Expand All @@ -47,7 +46,7 @@
from ZCatalogIndexes import ZCatalogIndexes


LOG = logging.getLogger('Zope.ZCatalog')
logger = logging.getLogger('Zope.ZCatalog')

manage_addZCatalogForm=DTMLFile('dtml/addZCatalog',globals())

Expand Down Expand Up @@ -304,8 +303,8 @@ def refreshCatalog(self, clear=0, pghandler=None):
except ConflictError:
raise
except:
LOG.error('Recataloging object at %s failed' % p,
exc_info=sys.exc_info())
logger.error('Recataloging object at %s failed' % p,
exc_info=sys.exc_info())

if pghandler: pghandler.finish()

Expand Down Expand Up @@ -494,8 +493,8 @@ def reindexIndex(self, name, REQUEST, pghandler=None):
if obj is None:
obj = self.resolve_url(p, REQUEST)
if obj is None:
LOG.error('reindexIndex could not resolve '
'an object from the uid %r.' % p)
logger.error('reindexIndex could not resolve '
'an object from the uid %r.' % p)
else:
# don't update metadata when only reindexing a single
# index via the UI
Expand Down Expand Up @@ -924,7 +923,7 @@ def manage_convertIndexes(self, REQUEST=None, RESPONSE=None, URL1=None):
classes.
"""

LOG.info('Start migration of indexes for %s' % self.absolute_url(1))
logger.info('Start migration of indexes for %s' % self.absolute_url(1))

for idx in self.Indexes.objectValues():
bases = [str(name) for name in idx.__class__.__bases__]
Expand All @@ -941,7 +940,7 @@ def manage_convertIndexes(self, REQUEST=None, RESPONSE=None, URL1=None):
if found:
idx_type = idx.meta_type
idx_id = idx.getId()
LOG.info('processing index %s' % idx_id)
logger.info('processing index %s' % idx_id)

indexed_attrs = getattr(idx, 'indexed_attrs', None)

Expand All @@ -963,7 +962,8 @@ def manage_convertIndexes(self, REQUEST=None, RESPONSE=None, URL1=None):
self.manage_reindexIndex(idx_id, REQUEST)

self._migrated_280 = True
LOG.info('Finished migration of indexes for %s' % self.absolute_url(1))
logger.info('Finished migration of indexes for %s'
% self.absolute_url(1))

if RESPONSE:
RESPONSE.redirect( URL1 +
Expand Down

0 comments on commit 18314a1

Please sign in to comment.