Commit c7f0524e authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

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