Commit c7f0524e authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent 5c4431b7
...@@ -16,6 +16,7 @@ $Id$ ...@@ -16,6 +16,7 @@ $Id$
""" """
import time import time
from logging import getLogger
from datetime import date, datetime from datetime import date, datetime
from datetime import tzinfo, timedelta from datetime import tzinfo, timedelta
from types import StringType, FloatType, IntType from types import StringType, FloatType, IntType
...@@ -28,7 +29,6 @@ from DateTime.DateTime import DateTime ...@@ -28,7 +29,6 @@ from DateTime.DateTime import DateTime
from Globals import DTMLFile from Globals import DTMLFile
from OFS.PropertyManager import PropertyManager from OFS.PropertyManager import PropertyManager
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from zLOG import LOG, ERROR
from zope.interface import implements from zope.interface import implements
from Products.PluginIndexes.common import safe_callable from Products.PluginIndexes.common import safe_callable
...@@ -36,6 +36,7 @@ from Products.PluginIndexes.common.UnIndex import UnIndex ...@@ -36,6 +36,7 @@ from Products.PluginIndexes.common.UnIndex import UnIndex
from Products.PluginIndexes.common.util import parseIndexRequest from Products.PluginIndexes.common.util import parseIndexRequest
from Products.PluginIndexes.interfaces import IDateIndex from Products.PluginIndexes.interfaces import IDateIndex
LOG = getLogger('DateIndex')
_marker = [] _marker = []
############################################################################### ###############################################################################
...@@ -144,10 +145,9 @@ class DateIndex(UnIndex, PropertyManager): ...@@ -144,10 +145,9 @@ class DateIndex(UnIndex, PropertyManager):
except ConflictError: except ConflictError:
raise raise
except: except:
LOG('UnIndex', ERROR, LOG.error("Should not happen: ConvertedDate was there,"
("Should not happen: ConvertedDate was there," " now it's not, for document with id %s" %
" now it's not, for document with id %s" % documentId)
documentId))
if ConvertedDate is not _marker: if ConvertedDate is not _marker:
self.insertForwardIndexEntry( ConvertedDate, documentId ) self.insertForwardIndexEntry( ConvertedDate, documentId )
......
...@@ -19,9 +19,9 @@ import operator, warnings ...@@ -19,9 +19,9 @@ import operator, warnings
import re import re
from cgi import escape from cgi import escape
from types import * from types import *
from logging import getLogger
from Globals import Persistent, DTMLFile from Globals import Persistent, DTMLFile
from zLOG import LOG, ERROR
from Acquisition import Implicit from Acquisition import Implicit
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from BTrees.IOBTree import IOBTree from BTrees.IOBTree import IOBTree
...@@ -39,6 +39,7 @@ from Products.PluginIndexes.interfaces import ITextIndex ...@@ -39,6 +39,7 @@ from Products.PluginIndexes.interfaces import ITextIndex
from Lexicon import Lexicon from Lexicon import Lexicon
LOG = getLogger('TextIndex')
class Op: class Op:
def __init__(self, name): def __init__(self, name):
...@@ -376,9 +377,8 @@ class TextIndex(Persistent, Implicit, SimpleItem): ...@@ -376,9 +377,8 @@ class TextIndex(Persistent, Implicit, SimpleItem):
for wid in wids: for wid in wids:
widScores = get(wid, None) widScores = get(wid, None)
if widScores is None: if widScores is None:
LOG('TextIndex', ERROR, LOG.error('unindex_object tried to unindex nonexistent'
'unindex_object tried to unindex nonexistent' ' document, wid %s, %s' % (i,wid))
' document, wid %s, %s' % (i,wid))
continue continue
if type(widScores) is TupleType: if type(widScores) is TupleType:
del index[wid] del index[wid]
...@@ -394,9 +394,8 @@ class TextIndex(Persistent, Implicit, SimpleItem): ...@@ -394,9 +394,8 @@ class TextIndex(Persistent, Implicit, SimpleItem):
else: else:
del index[wid] del index[wid]
except (KeyError, IndexError, TypeError): except (KeyError, IndexError, TypeError):
LOG('TextIndex', ERROR, LOG.error('unindex_object tried to unindex nonexistent'
'unindex_object tried to unindex nonexistent' ' document %s' % str(i))
' document %s' % str(i))
def __getitem__(self, word): def __getitem__(self, word):
"""Return an InvertedIndex-style result "list" """Return an InvertedIndex-style result "list"
......
...@@ -20,6 +20,7 @@ Python code. ...@@ -20,6 +20,7 @@ Python code.
__version__='$Revision: 1.56 $'[11:-2] __version__='$Revision: 1.56 $'[11:-2]
import sys, os, traceback, re, marshal, new import sys, os, traceback, re, marshal, new
from logging import getLogger
from Globals import DTMLFile, MessageDialog, package_home from Globals import DTMLFile, MessageDialog, package_home
import AccessControl, OFS, RestrictedPython import AccessControl, OFS, RestrictedPython
from Acquisition import aq_parent from Acquisition import aq_parent
...@@ -33,10 +34,12 @@ from AccessControl import getSecurityManager ...@@ -33,10 +34,12 @@ from AccessControl import getSecurityManager
from OFS.History import Historical, html_diff from OFS.History import Historical, html_diff
from OFS.Cache import Cacheable from OFS.Cache import Cacheable
from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
from zLOG import LOG, ERROR, INFO, PROBLEM
from zExceptions import Forbidden from zExceptions import Forbidden
import Globals import Globals
LOG = getLogger('PythonScripts')
# Track the Python bytecode version # Track the Python bytecode version
import imp import imp
Python_magic = imp.get_magic() Python_magic = imp.get_magic()
...@@ -209,7 +212,7 @@ class PythonScript(Script, Historical, Cacheable): ...@@ -209,7 +212,7 @@ class PythonScript(Script, Historical, Cacheable):
getattr(self, 'Script_magic', None) != Script_magic): getattr(self, 'Script_magic', None) != Script_magic):
global _log_complaint global _log_complaint
if _log_complaint: if _log_complaint:
LOG(self.meta_type, INFO, _log_complaint) LOG.info(_log_complaint)
_log_complaint = 0 _log_complaint = 0
# Changes here won't get saved, unless this Script is edited. # Changes here won't get saved, unless this Script is edited.
body = self._body.rstrip() body = self._body.rstrip()
...@@ -438,7 +441,7 @@ class PythonScript(Script, Historical, Cacheable): ...@@ -438,7 +441,7 @@ class PythonScript(Script, Historical, Cacheable):
else: else:
self._makeFunction() self._makeFunction()
except: except:
LOG(self.meta_type, ERROR, 'write failed', error=sys.exc_info()) LOG.error('write failed', exc_info=sys.exc_info())
raise raise
def manage_FTPget(self): def manage_FTPget(self):
......
...@@ -15,12 +15,12 @@ $Id$ ...@@ -15,12 +15,12 @@ $Id$
""" """
import time, sys import time, sys
from zLOG import LOG, INFO from logging import getLogger
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
from Interface import Interface from Interface import Interface
LOG = getLogger('ProgressHandler')
class IProgressHandler(Interface): class IProgressHandler(Interface):
""" A handler to log progress informations for long running """ A handler to log progress informations for long running
...@@ -92,7 +92,7 @@ class ZLogHandler(StdoutHandler): ...@@ -92,7 +92,7 @@ class ZLogHandler(StdoutHandler):
__implements__ = IProgressHandler __implements__ = IProgressHandler
def output(self, text): def output(self, text):
LOG(self._ident, INFO, text) LOG.info(text)
class FilelogHandler(StdoutHandler): class FilelogHandler(StdoutHandler):
......
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