[CalendarServer-changes] [4973] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jan 28 17:14:56 PST 2010


Revision: 4973
          http://trac.macosforge.org/projects/calendarserver/changeset/4973
Author:   wsanchez at apple.com
Date:     2010-01-28 17:14:53 -0800 (Thu, 28 Jan 2010)
Log Message:
-----------
twistedcaldav.log -> twext.log

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/provision/root.py
    CalendarServer/trunk/calendarserver/sidecar/task.py
    CalendarServer/trunk/calendarserver/tap/caldav.py
    CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py
    CalendarServer/trunk/calendarserver/tools/principals.py
    CalendarServer/trunk/memcacheclient.py
    CalendarServer/trunk/twext/internet/tcp.py
    CalendarServer/trunk/twistedcaldav/accesslog.py
    CalendarServer/trunk/twistedcaldav/accounting.py
    CalendarServer/trunk/twistedcaldav/authkerb.py
    CalendarServer/trunk/twistedcaldav/cache.py
    CalendarServer/trunk/twistedcaldav/caldavxml.py
    CalendarServer/trunk/twistedcaldav/client/pool.py
    CalendarServer/trunk/twistedcaldav/client/reverseproxy.py
    CalendarServer/trunk/twistedcaldav/database.py
    CalendarServer/trunk/twistedcaldav/directory/augment.py
    CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py
    CalendarServer/trunk/twistedcaldav/directory/calendar.py
    CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
    CalendarServer/trunk/twistedcaldav/directory/calendaruserproxyloader.py
    CalendarServer/trunk/twistedcaldav/directory/digest.py
    CalendarServer/trunk/twistedcaldav/directory/directory.py
    CalendarServer/trunk/twistedcaldav/directory/principal.py
    CalendarServer/trunk/twistedcaldav/directory/resourceinfo.py
    CalendarServer/trunk/twistedcaldav/directory/wiki.py
    CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
    CalendarServer/trunk/twistedcaldav/directory/xmlaugmentsparser.py
    CalendarServer/trunk/twistedcaldav/dropbox.py
    CalendarServer/trunk/twistedcaldav/extensions.py
    CalendarServer/trunk/twistedcaldav/ical.py
    CalendarServer/trunk/twistedcaldav/index.py
    CalendarServer/trunk/twistedcaldav/localization.py
    CalendarServer/trunk/twistedcaldav/mail.py
    CalendarServer/trunk/twistedcaldav/memcachepool.py
    CalendarServer/trunk/twistedcaldav/memcacheprops.py
    CalendarServer/trunk/twistedcaldav/memcacher.py
    CalendarServer/trunk/twistedcaldav/method/copymove.py
    CalendarServer/trunk/twistedcaldav/method/delete.py
    CalendarServer/trunk/twistedcaldav/method/delete_common.py
    CalendarServer/trunk/twistedcaldav/method/mkcalendar.py
    CalendarServer/trunk/twistedcaldav/method/propfind.py
    CalendarServer/trunk/twistedcaldav/method/put.py
    CalendarServer/trunk/twistedcaldav/method/put_common.py
    CalendarServer/trunk/twistedcaldav/method/report.py
    CalendarServer/trunk/twistedcaldav/method/report_calquery.py
    CalendarServer/trunk/twistedcaldav/method/report_common.py
    CalendarServer/trunk/twistedcaldav/method/report_freebusy.py
    CalendarServer/trunk/twistedcaldav/method/report_multiget.py
    CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
    CalendarServer/trunk/twistedcaldav/notify.py
    CalendarServer/trunk/twistedcaldav/partitions.py
    CalendarServer/trunk/twistedcaldav/pdmonster.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/scheduling/addressmapping.py
    CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
    CalendarServer/trunk/twistedcaldav/scheduling/cuaddress.py
    CalendarServer/trunk/twistedcaldav/scheduling/delivery.py
    CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
    CalendarServer/trunk/twistedcaldav/scheduling/imip.py
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
    CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py
    CalendarServer/trunk/twistedcaldav/scheduling/ischeduleservers.py
    CalendarServer/trunk/twistedcaldav/scheduling/itip.py
    CalendarServer/trunk/twistedcaldav/scheduling/processing.py
    CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
    CalendarServer/trunk/twistedcaldav/sql.py
    CalendarServer/trunk/twistedcaldav/static.py
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/twistedcaldav/test/test_config.py
    CalendarServer/trunk/twistedcaldav/test/test_log.py
    CalendarServer/trunk/twistedcaldav/timezones.py
    CalendarServer/trunk/twistedcaldav/upgrade.py
    CalendarServer/trunk/twistedcaldav/util.py

Added Paths:
-----------
    CalendarServer/trunk/twext/log.py

Removed Paths:
-------------
    CalendarServer/trunk/twistedcaldav/log.py

Modified: CalendarServer/trunk/calendarserver/provision/root.py
===================================================================
--- CalendarServer/trunk/calendarserver/provision/root.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/calendarserver/provision/root.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,18 +20,18 @@
 
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.cred.error import LoginFailed, UnauthorizedLogin
-
 from twisted.web2 import responsecode
 from twisted.web2.dav import davxml
 from twisted.web2.http import HTTPError, StatusResponse
 from twisted.web2.auth.wrapper import UnauthorizedResponse
 from twisted.web.xmlrpc import Proxy
 
+from twext.log import Logger
+
 from twistedcaldav.extensions import DAVFile, CachingPropertyStore
 from twistedcaldav.extensions import DirectoryPrincipalPropertySearchMixIn
 from twistedcaldav.extensions import ReadOnlyResourceMixIn
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 from twistedcaldav.cache import _CachedResponseResource
 from twistedcaldav.cache import MemcacheResponseCache, MemcacheChangeNotifier
 from twistedcaldav.cache import DisabledCache

Modified: CalendarServer/trunk/calendarserver/sidecar/task.py
===================================================================
--- CalendarServer/trunk/calendarserver/sidecar/task.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/calendarserver/sidecar/task.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -22,8 +22,11 @@
     "Task",
 ]
 
-from calendarserver.provision.root import RootResource
 from time import sleep
+import os
+
+from zope.interface import implements
+
 from twisted.application.service import Service, IServiceMaker
 from twisted.internet.address import IPv4Address
 from twisted.internet.defer import DeferredList, inlineCallbacks, returnValue
@@ -32,20 +35,22 @@
 from twisted.python.reflect import namedClass
 from twisted.python.usage import Options, UsageError
 from twisted.web2.http_headers import Headers
+
+from twext.log import Logger, LoggingMixIn
+from twext.log import logLevelForNamespace, setLogLevelForNamespace
+
 from twistedcaldav import memcachepool
 from twistedcaldav.config import config
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
 from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
 from twistedcaldav.ical import Component
-from twistedcaldav.log import Logger, LoggingMixIn
-from twistedcaldav.log import logLevelForNamespace, setLogLevelForNamespace
 from twistedcaldav.notify import installNotificationClient
 from twistedcaldav.scheduling.cuaddress import LocalCalendarUser
 from twistedcaldav.scheduling.scheduler import DirectScheduler
 from twistedcaldav.static import CalendarHomeProvisioningFile
-from zope.interface import implements
-import os
 
+from calendarserver.provision.root import RootResource
+
 log = Logger()
 
 class FakeRequest(object):

Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -54,17 +54,19 @@
 from twisted.web2.server import Site
 from twisted.web2.static import File as FileResource
 
+from twext.log import Logger, LoggingMixIn
+from twext.log import logLevelForNamespace, setLogLevelForNamespace
 from twext.internet.ssl import ChainingOpenSSLContextFactory
 from twext.internet.tcp import MaxAcceptTCPServer, MaxAcceptSSLServer
 from twext.web2.channel.http import LimitingHTTPFactory, SSLRedirectRequest
 
 try:
     from twistedcaldav.version import version
-    version                     # pacify pyflakes
 except ImportError:
     sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "support"))
     from version import version as getVersion
     version = "%s (%s)" % getVersion()
+
 from twistedcaldav import memcachepool
 from twistedcaldav.accesslog import AMPCommonAccessLoggingObserver
 from twistedcaldav.accesslog import AMPLoggingFactory
@@ -81,8 +83,6 @@
 from twistedcaldav.directory.util import NotFilePath
 from twistedcaldav.directory.wiki import WikiDirectoryService
 from twistedcaldav.localization import processLocalizationFiles
-from twistedcaldav.log import Logger, LoggingMixIn
-from twistedcaldav.log import logLevelForNamespace, setLogLevelForNamespace
 from twistedcaldav.mail import IMIPReplyInboxResource
 from twistedcaldav.notify import installNotificationClient
 from twistedcaldav.pdmonster import PDClientAddressWrapper

Modified: CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -15,12 +15,16 @@
 # limitations under the License.
 ##
 
-from calendarserver.tools.util import loadConfig, getDirectory,\
-    autoDisableMemcached
+import os
+import sys
+
 from getopt import getopt, GetoptError
 from grp import getgrnam
 from pwd import getpwnam
 from sys import stdout, stderr
+
+from twext.log import setLogLevelForNamespace
+
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
 from twisted.python.log import addObserver, removeObserver
@@ -28,10 +32,10 @@
 from twistedcaldav.config import config, ConfigurationError
 from twistedcaldav.directory import augment
 from twistedcaldav.directory.augment import AugmentXMLDB
-from twistedcaldav.log import setLogLevelForNamespace
-import os
-import sys
 
+from calendarserver.tools.util import loadConfig, getDirectory,\
+    autoDisableMemcached
+
 class UsageError (StandardError):
     pass
 

Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/calendarserver/tools/principals.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -30,12 +30,12 @@
 from twisted.internet.defer import inlineCallbacks
 from twisted.web2.dav import davxml
 
+from twext.log import setLogLevelForNamespace
 from twext.python.log import StandardIOObserver
 from twext.web2.dav.davxml import sname2qname, qname2sname
 
 from twistedcaldav import memcachepool
 from twistedcaldav.config import config, ConfigurationError
-from twistedcaldav.log import setLogLevelForNamespace
 from twistedcaldav.notify import installNotificationClient
 from twistedcaldav.static import CalendarHomeProvisioningFile
 from twistedcaldav.directory.directory import UnknownRecordTypeError, DirectoryError

Modified: CalendarServer/trunk/memcacheclient.py
===================================================================
--- CalendarServer/trunk/memcacheclient.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/memcacheclient.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -49,8 +49,10 @@
 import os
 import re
 import types
+
+from twext.log import Logger
+
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twext/internet/tcp.py
===================================================================
--- CalendarServer/trunk/twext/internet/tcp.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twext/internet/tcp.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -23,12 +23,14 @@
     "MaxAcceptSSLServer",
 ]
 
+import socket
 from OpenSSL import SSL
+
 from twisted.application import internet
 from twisted.internet import tcp, ssl
-from twistedcaldav.log import Logger
-import socket
 
+from twext.log import Logger
+
 log = Logger()
 
 

Copied: CalendarServer/trunk/twext/log.py (from rev 4972, CalendarServer/trunk/twistedcaldav/log.py)
===================================================================
--- CalendarServer/trunk/twext/log.py	                        (rev 0)
+++ CalendarServer/trunk/twext/log.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -0,0 +1,317 @@
+##
+# Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Classes and functions to do granular logging.
+
+Example usage in a module:
+
+    from twext.log import Logger
+    log = Logger()
+
+    log.info("Blah blah")
+
+Or in a class:
+
+    from twext.log import LoggingMixIn
+
+    class Foo (LoggingMixIn):
+        def oops(self):
+            self.log_error("Oops!")
+
+C{Logger}s have namespaces, for which logging can be configured
+independently.  Namespaces may be specified by passing in a
+C{namespace} argument to L{Logger} when instantiating it, but if none
+is given, the logger will derive its own namespace by using the module
+name of the callable that instantiating it, or, in the case of a
+L{LoggingMixIn}, by using the fully qualified name of the class.
+
+In the first example above, the namespace would be C{some.module}, and
+in the second example, it would be C{some.module.Foo}.
+"""
+
+__all__ = [
+    "logLevels",
+    "cmpLogLevels",
+    "pythonLogLevelForLevel",
+    "logLevelForNamespace",
+    "setLogLevelForNamespace",
+    "clearLogLevels",
+    "logLevelsByNamespace",
+    "Logger",
+    "LoggingMixIn",
+    "InvalidLogLevelError",
+]
+
+import inspect
+import logging
+
+from twisted.python import log
+
+logLevels = (
+    "debug",
+    "info",
+    "warn",
+    "error",
+)
+
+logLevelIndexes = dict(zip(logLevels, xrange(0, len(logLevels))))
+
+def cmpLogLevels(a, b):
+    """
+    Compare two log levels.
+    @param a: a log level
+    @param b: a log level
+    @return: a negative integer if C{a < b}, C{0} if C{a == b}, or a
+        positive integer if C{a > b}.
+    """
+    return cmp(logLevelIndexes[a], logLevelIndexes[b])
+
+##
+# Mappings to Python's logging module
+##
+
+pythonLogLevelMapping = {
+    "debug"   : logging.DEBUG,
+    "info"    : logging.INFO,
+    "warn"    : logging.WARNING,
+    "error"   : logging.ERROR,
+   #"critical": logging.CRITICAL,
+}
+
+def pythonLogLevelForLevel(level):
+    """
+    @param: a log level
+    @return: a L{logging} module log level
+    """
+    if level in pythonLogLevelMapping:
+        return pythonLogLevelMapping[level]
+
+    raise InvalidLogLevelError(level)
+
+#    #
+#    # In case we add log levels that don't map to pythong logging levels:
+#    #
+#    for l in logLevels:
+#        print "Trying %s: %s, %s" % (l, l in pythonLogLevelMapping, cmpLogLevels(level, l) <= 0)
+#        if l in pythonLogLevelMapping and cmpLogLevels(level, l) <= 0:
+#            return pythonLogLevelMapping[l]
+#
+#    return logging.CRITICAL
+
+##
+# Tools for managing log levels
+##
+
+def logLevelForNamespace(namespace):
+    """
+    @param namespace: a logging namespace, or C{None} to set the
+        default log level.
+    @return: the log level for the given namespace.
+    """
+    if not namespace:
+        return logLevelsByNamespace[None]
+
+    if namespace in logLevelsByNamespace:
+        return logLevelsByNamespace[namespace]
+
+    segments = namespace.split(".")
+    index = len(segments) - 1
+
+    while index > 0:
+        namespace = ".".join(segments[:index])
+        if namespace in logLevelsByNamespace:
+            return logLevelsByNamespace[namespace]
+        index -= 1
+
+    return logLevelsByNamespace[None]
+
+def setLogLevelForNamespace(namespace, level):
+    """
+    Sets the log level for a logging namespace.
+    @param namespace: a logging namespace
+    @param level: the log level for the given namespace.
+    """
+    if level not in logLevels:
+        raise InvalidLogLevelError(level)
+
+    if namespace:
+        logLevelsByNamespace[namespace] = level
+    else:
+        logLevelsByNamespace[None] = level
+
+def clearLogLevels():
+    """
+    Clears all log levels to the default.
+    """
+    logLevelsByNamespace.clear()
+    logLevelsByNamespace[None] = "warn"  # Default log level
+
+logLevelsByNamespace = {}
+clearLogLevels()
+
+##
+# Loggers
+##
+
+class Logger (object):
+    """
+    Logging object.
+    """
+    def __init__(self, namespace=None):
+        """
+        @param namespace: The namespace for this logger.  Uses a
+            dotted notation, as used by python modules.  If not
+            C{None}, then the name of the module of the caller
+            is used.
+        """
+        if namespace is None:
+            currentFrame = inspect.currentframe()
+            callerFrame  = currentFrame.f_back
+            callerModule = callerFrame.f_globals["__name__"]
+
+            namespace = callerModule
+
+        self.namespace = namespace
+
+    def __repr__(self):
+        return "<%s %r>" % (self.__class__.__name__, self.namespace)
+
+    def emit(self, level, message, **kwargs):
+        """
+        Called internally to emit log messages at a given log level.
+        """
+        assert level in logLevels, "Unknown log level: %r" % (level,)
+
+        logLevel = pythonLogLevelForLevel(level)
+
+        # FIXME: Filtering should be done by the log observer(s)
+        if not self.willLogAtLevel(level):
+            return
+
+        kwargs["level"] = level
+        kwargs["logLevel"] = logLevel
+        kwargs["namespace"] = self.namespace
+
+        log.msg(
+            # FIXME: This formatting should be done by the log observer(s)
+            "[%s#%s] %s" % (self.namespace, level, message),
+            **kwargs
+        )
+
+    def level(self):
+        """
+        @return: the logging level for this logger's namespace.
+        """
+        return logLevelForNamespace(self.namespace)
+
+    def setLevel(self, level):
+        """
+        Set the logging level for this logger's namespace.
+        @param level: a logging level
+        """
+        setLogLevelForNamespace(self.namespace, level)
+
+    def willLogAtLevel(self, level):
+        """
+        @param level: a logging level
+        @return: C{True} if this logger will log at the given logging
+            level.
+        """
+        return cmpLogLevels(self.level(), level) <= 0
+
+
+class LoggingMixIn (object):
+    """
+    Mix-in class for logging methods.
+    """
+    def _getLogger(self):
+        try:
+            return self._logger
+        except AttributeError:
+            self._logger = Logger(
+                "%s.%s" % (
+                    self.__class__.__module__,
+                    self.__class__.__name__,
+                )
+            )
+
+        return self._logger
+
+    def _setLogger(self, value):
+        self._logger = value
+
+    logger = property(_getLogger, _setLogger)
+
+for level in logLevels:
+    doc = """
+    Emit a log message at log level C{%s}.
+    @param message: The message to emit.
+    """ % (level,)
+
+    #
+    # Attach methods to Logger
+    #
+    def log_emit(self, message, __level__=level, raiseException=None, **kwargs):
+        self.emit(__level__, message, **kwargs)
+        if raiseException:
+            raise raiseException(message)
+
+    def will_emit(self, __level__=level):
+        return self.willLogAtLevel(__level__)
+
+    log_emit.__doc__ = doc
+
+    setattr(Logger, level, log_emit)
+    setattr(Logger, level + "_enabled", property(will_emit))
+
+    del log_emit
+    del will_emit
+
+    #
+    # Attach methods to LoggingMixIn
+    #
+    def log_emit(self, message, __level__=level, raiseException=None, **kwargs):
+        self.logger.emit(__level__, message, **kwargs)
+        if raiseException:
+            raise raiseException(message)
+
+    def will_emit(self=log_emit, __level__=level):
+        return self.logger.willLogAtLevel(__level__)
+
+    log_emit.__doc__ = doc
+    log_emit.enabled = will_emit
+
+    setattr(LoggingMixIn, "log_" + level, log_emit)
+    setattr(LoggingMixIn, "log_" + level + "_enabled", property(will_emit))
+
+    del log_emit
+    del will_emit
+
+del level
+
+# Add some compatibility with twisted's log module
+Logger.msg = Logger.info
+Logger.err = Logger.error
+
+##
+# Errors
+##
+
+class InvalidLogLevelError (RuntimeError):
+    def __init__(self, level):
+        super(InvalidLogLevelError, self).__init__(str(level))
+        self.level = level

Modified: CalendarServer/trunk/twistedcaldav/accesslog.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/accesslog.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/accesslog.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -31,15 +31,15 @@
 
 from twisted.internet import protocol
 from twisted.protocols import amp
-
 from twisted.web2 import iweb
 from twisted.web2.dav import davxml
 from twisted.web2.log import BaseCommonAccessLoggingObserver
 from twisted.web2.log import LogWrapperResource
 
+from twext.log import Logger
+
 from twistedcaldav.config import config
 from twistedcaldav.directory.directory import DirectoryService
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/accounting.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/accounting.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/accounting.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -27,8 +27,9 @@
 import datetime
 import os
 
+from twext.log import Logger
+
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/authkerb.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/authkerb.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/authkerb.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -46,7 +46,7 @@
 from twisted.web2.auth.interfaces import ICredentialFactory
 from twisted.web2.dav.auth import IPrincipalCredentials
 
-from twistedcaldav.log import LoggingMixIn
+from twext.log import LoggingMixIn
 
 class KerberosCredentialFactoryBase(LoggingMixIn):
     """

Modified: CalendarServer/trunk/twistedcaldav/cache.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/cache.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/cache.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -21,13 +21,13 @@
 from zope.interface import implements
 
 from twisted.internet.defer import succeed, maybeDeferred
-
 from twisted.web2.dav.util import allDataFromStream
 from twisted.web2.http import Response
 from twisted.web2.iweb import IResource
 from twisted.web2.stream import MemoryStream
 
-from twistedcaldav.log import LoggingMixIn
+from twext.log import LoggingMixIn
+
 from twistedcaldav.memcachepool import CachePoolUserMixIn, defaultCachePool
 from twistedcaldav.config import config
 

Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -31,11 +31,12 @@
 
 from twisted.web2.dav import davxml
 
+from twext.log import Logger
+
 from twistedcaldav.dateops import clipPeriod, timeRangesOverlap
 from twistedcaldav.ical import Component as iComponent
 from twistedcaldav.ical import Property as iProperty
 from twistedcaldav.ical import parse_date_or_datetime
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/client/pool.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/client/pool.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/client/pool.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,7 +20,12 @@
     "getHTTPClientPool",
 ]
 
+import OpenSSL
+import urlparse
+
+from twext.log import LoggingMixIn
 from twext.internet.ssl import ChainingOpenSSLContextFactory
+
 from twisted.internet.address import IPv4Address
 from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
 from twisted.internet.error import ConnectionLost, ConnectionDone, ConnectError
@@ -29,9 +34,6 @@
 from twisted.web2.client.http import HTTPClientProtocol
 from twisted.web2.http import StatusResponse, HTTPError
 from twistedcaldav.config import config
-from twistedcaldav.log import LoggingMixIn
-import OpenSSL
-import urlparse
 
 class PooledHTTPClientFactory(ClientFactory, LoggingMixIn):
     """

Modified: CalendarServer/trunk/twistedcaldav/client/reverseproxy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/client/reverseproxy.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/client/reverseproxy.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -18,17 +18,19 @@
     "ReverseProxyResource",
 ]
 
+import urllib
+
+from zope.interface.declarations import implements
+
 from twisted.web2 import iweb
 from twisted.web2.client.http import ClientRequest
 from twisted.web2.resource import LeafResource
 
+from twext.log import LoggingMixIn
+
 from twistedcaldav.client.pool import getHTTPClientPool
 from twistedcaldav.config import config
-from twistedcaldav.log import LoggingMixIn
 
-import urllib
-from zope.interface.declarations import implements
-
 class ReverseProxyResource(LeafResource, LoggingMixIn):
     """
     A L{LeafResource} which always performs a reverse proxy operation.

Modified: CalendarServer/trunk/twistedcaldav/database.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/database.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/database.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,13 +14,6 @@
 # limitations under the License.
 ##
 
-from twisted.enterprise.adbapi import ConnectionPool
-from twisted.internet.defer import inlineCallbacks, returnValue
-from twisted.python.threadpool import ThreadPool
-
-from twistedcaldav.config import ConfigurationError
-from twistedcaldav.log import Logger
-
 import thread
 
 try:
@@ -29,6 +22,14 @@
     pgdb = None
 #pgdb = None
 
+from twisted.enterprise.adbapi import ConnectionPool
+from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.python.threadpool import ThreadPool
+
+from twext.log import Logger
+
+from twistedcaldav.config import ConfigurationError
+
 """
 Generic ADAPI database access object.
 """

Modified: CalendarServer/trunk/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/augment.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/augment.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,15 +14,17 @@
 # limitations under the License.
 ##
 
+import copy
+import time
 
 from twisted.internet.defer import inlineCallbacks, returnValue, succeed
+
+from twext.log import Logger
+
 from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
     ADBAPIPostgreSQLMixin
 from twistedcaldav.directory.xmlaugmentsparser import XMLAugmentsParser
-import copy
-import time
 
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/cachingdirectory.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -31,9 +31,10 @@
 import memcacheclient
 import base64
 
+from twext.log import LoggingMixIn
+
 from twistedcaldav.config import config
 from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord, DirectoryError, UnknownRecordTypeError
-from twistedcaldav.log import LoggingMixIn
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 
 

Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendar.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/calendar.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -34,6 +34,8 @@
 from twisted.web2.dav.util import joinURL
 from twisted.web2.dav.resource import TwistedACLInheritable
 
+from twext.log import Logger
+
 from twistedcaldav import caldavxml
 from twistedcaldav.config import config
 from twistedcaldav.dropbox import DropBoxHomeResource
@@ -45,7 +47,6 @@
 from twistedcaldav.directory.wiki import getWikiACL
 from twistedcaldav.directory.resource import AutoProvisioningResourceMixIn
 
-from twistedcaldav.log import Logger
 log = Logger()
 
 # Use __underbars__ convention to avoid conflicts with directory resource types.

Modified: CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -26,6 +26,9 @@
     "ProxyPostgreSQLDB",
 ]
 
+import itertools
+import time
+
 from twisted.internet.defer import succeed, inlineCallbacks, returnValue
 from twisted.web2 import responsecode
 from twisted.web2.http import HTTPError, StatusResponse
@@ -34,6 +37,8 @@
 from twisted.web2.dav.util import joinURL
 from twisted.web2.dav.noneprops import NonePropertyStore
 
+from twext.log import LoggingMixIn
+
 from twistedcaldav.config import config
 from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
     ADBAPIPostgreSQLMixin
@@ -42,11 +47,7 @@
 from twistedcaldav.memcacher import Memcacher
 from twistedcaldav.resource import CalDAVComplianceMixIn
 from twistedcaldav.directory.util import NotFilePath
-from twistedcaldav.log import LoggingMixIn
 
-import itertools
-import time
-
 class PermissionsMixIn (ReadOnlyWritePropertiesResourceMixIn):
     def defaultAccessControlList(self):
         aces = (

Modified: CalendarServer/trunk/twistedcaldav/directory/calendaruserproxyloader.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendaruserproxyloader.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/calendaruserproxyloader.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,12 +14,6 @@
 # limitations under the License.
 ##
 
-from xml.etree.ElementTree import ElementTree
-from xml.parsers.expat import ExpatError
-from twistedcaldav.directory import calendaruserproxy
-from twisted.internet.defer import inlineCallbacks
-import types
-
 """
 XML based calendar user proxy loader.
 """
@@ -28,8 +22,16 @@
     "XMLCalendarUserProxyLoader",
 ]
 
-from twistedcaldav.log import Logger
+import types
+from xml.etree.ElementTree import ElementTree
+from xml.parsers.expat import ExpatError
 
+from twisted.internet.defer import inlineCallbacks
+
+from twext.log import Logger
+
+from twistedcaldav.directory import calendaruserproxy
+
 log = Logger()
 
 ELEMENT_PROXIES           = "proxies"

Modified: CalendarServer/trunk/twistedcaldav/directory/digest.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/digest.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/digest.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -23,7 +23,8 @@
 from twisted.web2.http_headers import split
 from twisted.web2.http_headers import tokenize
 
-from twistedcaldav.log import Logger
+from twext.log import Logger
+
 from twistedcaldav.memcacher import Memcacher
 
 from zope.interface import implements, Interface

Modified: CalendarServer/trunk/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/directory.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/directory.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -38,8 +38,9 @@
 from twisted.web2.dav.auth import IPrincipalCredentials
 from twisted.internet.defer import succeed
 
+from twext.log import LoggingMixIn
+
 from twistedcaldav.config import config
-from twistedcaldav.log import LoggingMixIn
 from twistedcaldav.directory.idirectory import IDirectoryService, IDirectoryRecord
 from twistedcaldav.directory.util import uuidFromName
 from twistedcaldav.partitions import partitions

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -48,10 +48,11 @@
 from twisted.web2.dav.util import joinURL
 from twisted.web2.dav.noneprops import NonePropertyStore
 
+from twext.log import Logger
+
 from twistedcaldav.authkerb import NegotiateCredentials
 from twistedcaldav.config import config
 from twistedcaldav.cache import DisabledCacheNotifier, PropfindCacheMixin
-
 from twistedcaldav.directory import calendaruserproxy
 from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyPrincipalResource
 from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
@@ -59,7 +60,6 @@
 from twistedcaldav.extensions import ReadOnlyResourceMixIn, DAVFile, DAVPrincipalResource
 from twistedcaldav.resource import CalendarPrincipalCollectionResource, CalendarPrincipalResource
 from twistedcaldav.directory.idirectory import IDirectoryService
-from twistedcaldav.log import Logger
 from twistedcaldav import caldavxml, customxml
 from twistedcaldav.customxml import calendarserver_namespace
 from twistedcaldav.directory.wiki import getWikiACL

Modified: CalendarServer/trunk/twistedcaldav/directory/resourceinfo.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/resourceinfo.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/resourceinfo.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -22,11 +22,14 @@
     "ResourceInfoDatabase",
 ]
 
+import os
+
 from twisted.internet.defer import inlineCallbacks, returnValue
-from twistedcaldav.log import LoggingMixIn
+
+from twext.log import LoggingMixIn
+
 from twistedcaldav.memcacher import Memcacher
 from twistedcaldav.sql import AbstractSQLDatabase, db_prefix
-import os
 
 class ResourceInfoDatabase(AbstractSQLDatabase, LoggingMixIn):
     """

Modified: CalendarServer/trunk/twistedcaldav/directory/wiki.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/wiki.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/wiki.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -23,20 +23,19 @@
     "WikiDirectoryService",
 ]
 
+from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.web2.dav import davxml
 from twisted.web.xmlrpc import Proxy, Fault
 from twisted.web2.http import HTTPError, StatusResponse
 from twisted.web2.auth.wrapper import UnauthorizedResponse
 
-from twisted.internet.defer import inlineCallbacks, returnValue
+from twext.log import Logger
 
-
 from twisted.web2.dav.resource import TwistedACLInheritable
 from twistedcaldav.config import config
 from twistedcaldav.directory.directory import (DirectoryService,
                                                DirectoryRecord,
                                                UnknownRecordTypeError)
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -27,8 +27,9 @@
 
 from twisted.python.filepath import FilePath
 
+from twext.log import Logger
+
 from twistedcaldav.directory.directory import DirectoryService
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/directory/xmlaugmentsparser.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/xmlaugmentsparser.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/directory/xmlaugmentsparser.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,10 +14,6 @@
 # limitations under the License.
 ##
 
-from xml.etree.ElementTree import ElementTree
-from xml.parsers.expat import ExpatError
-import types
-
 """
 XML based augment configuration file handling.
 """
@@ -26,8 +22,12 @@
     "XMLAugmentsParser",
 ]
 
-from twistedcaldav.log import Logger
+from xml.etree.ElementTree import ElementTree
+from xml.parsers.expat import ExpatError
+import types
 
+from twext.log import Logger
+
 log = Logger()
 
 ELEMENT_AUGMENTS          = "augments"

Modified: CalendarServer/trunk/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dropbox.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/dropbox.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -28,8 +28,9 @@
 from twisted.web2.dav import davxml
 from twisted.web2.dav.resource import DAVResource, TwistedACLInheritable
 
+from twext.log import Logger
+
 from twistedcaldav.customxml import calendarserver_namespace
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/extensions.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -56,9 +56,10 @@
 from twisted.web2.dav.method import prop_common
 from twisted.web2.dav.method.report import max_number_of_matches
 
+from twext.log import Logger, LoggingMixIn
+
 from twistedcaldav import customxml
 from twistedcaldav.customxml import calendarserver_namespace
-from twistedcaldav.log import Logger, LoggingMixIn
 from twistedcaldav.util import submodule, Alternator, printTracebacks
 from twistedcaldav.directory.sudo import SudoDirectoryService
 from twistedcaldav.directory.directory import DirectoryService

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -32,24 +32,26 @@
     "tzexpand",
 ]
 
+import cStringIO as StringIO
+import datetime
+import heapq
+import itertools
+
+from vobject import newFromBehavior, readComponents
+from vobject.base import Component as vComponent, ContentLine as vContentLine, ParseError as vParseError
+from vobject.icalendar import TimezoneComponent, dateTimeToString, deltaToOffset, getTransition, stringToDate, stringToDateTime, stringToDurations, utc
+
 from twisted.web2.dav.util import allDataFromStream
 from twisted.web2.stream import IStream
 
+from twext.log import Logger
+
 from twistedcaldav.dateops import compareDateTime, normalizeToUTC, timeRangesOverlap,\
     normalizeStartEndDuration, toString, normalizeForIndex, differenceDateTime
 from twistedcaldav.instance import InstanceList
-from twistedcaldav.log import Logger
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 
-from vobject import newFromBehavior, readComponents
-from vobject.base import Component as vComponent, ContentLine as vContentLine, ParseError as vParseError
-from vobject.icalendar import TimezoneComponent, dateTimeToString, deltaToOffset, getTransition, stringToDate, stringToDateTime, stringToDurations, utc
 
-import cStringIO as StringIO
-import datetime
-import heapq
-import itertools
-
 log = Logger()
 
 iCalendarProductID = "-//CALENDARSERVER.ORG//NONSGML Version 1//EN"

Modified: CalendarServer/trunk/twistedcaldav/index.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/index.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/index.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -44,13 +44,14 @@
 
 from twisted.internet.defer import maybeDeferred, succeed
 
+from twext.log import Logger, LoggingMixIn
+
 from twistedcaldav.ical import Component
 from twistedcaldav.query import calendarquery
 from twistedcaldav.sql import AbstractSQLDatabase
 from twistedcaldav.sql import db_prefix
 from twistedcaldav import caldavxml
 from twistedcaldav.instance import InvalidOverriddenInstanceError
-from twistedcaldav.log import Logger, LoggingMixIn
 from twistedcaldav.config import config
 from twistedcaldav.memcachepool import CachePoolUserMixIn
 

Modified: CalendarServer/trunk/twistedcaldav/localization.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/localization.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/localization.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -23,8 +23,10 @@
 import array
 import codecs
 from locale import normalize
+
+from twext.log import Logger
+
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Deleted: CalendarServer/trunk/twistedcaldav/log.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/log.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/log.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -1,404 +0,0 @@
-##
-# Copyright (c) 2006-2010 Apple Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-
-"""
-Classes and functions to do better logging.
-
-Example usage in a module:
-
-    from twistedcaldav.log import Logger
-    log = Logger()
-
-    log.info("Blah blah")
-
-Or in a class:
-
-    from twistedcaldav.log import LoggingMixIn
-
-    class Foo (LoggingMixIn):
-        def oops(self):
-            self.log_error("Oops!")
-
-C{Logger}s have namespaces, for which logging can be configured
-independently.  Namespaces may be specified by passing in a
-C{namespace} argument to L{Logger} when instantiating it, but if none
-is given, the logger will derive its own namespace by using the module
-name of the callable that instantiating it, or, in the case of a
-L{LoggingMixIn}, by using the fully qualified name of the class.
-
-In the first example above, the namespace would be C{some.module}, and
-in the second example, it would be C{some.module.Foo}.
-"""
-
-__all__ = [
-    "logLevels",
-    "cmpLogLevels",
-    "pythonLogLevelForLevel",
-    "logLevelForNamespace",
-    "setLogLevelForNamespace",
-    "clearLogLevels",
-    "logLevelsByNamespace",
-    "Logger",
-    "LoggingMixIn",
-    "InvalidLogLevelError",
-]
-
-import inspect
-import logging
-
-from twisted.python import log
-
-from StringIO import StringIO
-
-from twisted.internet.defer import succeed
-
-from twisted.web2 import responsecode
-from twisted.web2.dav.util import allDataFromStream
-from twisted.web2.stream import MemoryStream
-
-logLevels = (
-    "debug",
-    "info",
-    "warn",
-    "error",
-)
-
-logLevelIndexes = dict(zip(logLevels, xrange(0, len(logLevels))))
-
-def cmpLogLevels(a, b):
-    """
-    Compare two log levels.
-    @param a: a log level
-    @param b: a log level
-    @return: a negative integer if C{a < b}, C{0} if C{a == b}, or a
-        positive integer if C{a > b}.
-    """
-    return cmp(logLevelIndexes[a], logLevelIndexes[b])
-
-##
-# Mappings to Python's logging module
-##
-
-pythonLogLevelMapping = {
-    "debug"   : logging.DEBUG,
-    "info"    : logging.INFO,
-    "warn"    : logging.WARNING,
-    "error"   : logging.ERROR,
-   #"critical": logging.CRITICAL,
-}
-
-def pythonLogLevelForLevel(level):
-    """
-    @param: a log level
-    @return: a L{logging} module log level
-    """
-    if level in pythonLogLevelMapping:
-        return pythonLogLevelMapping[level]
-
-    raise InvalidLogLevelError(level)
-
-#    #
-#    # In case we add log levels that don't map to pythong logging levels:
-#    #
-#    for l in logLevels:
-#        print "Trying %s: %s, %s" % (l, l in pythonLogLevelMapping, cmpLogLevels(level, l) <= 0)
-#        if l in pythonLogLevelMapping and cmpLogLevels(level, l) <= 0:
-#            return pythonLogLevelMapping[l]
-#
-#    return logging.CRITICAL
-
-##
-# Tools for managing log levels
-##
-
-def logLevelForNamespace(namespace):
-    """
-    @param namespace: a logging namespace, or C{None} to set the
-        default log level.
-    @return: the log level for the given namespace.
-    """
-    if not namespace:
-        return logLevelsByNamespace[None]
-
-    if namespace in logLevelsByNamespace:
-        return logLevelsByNamespace[namespace]
-
-    segments = namespace.split(".")
-    index = len(segments) - 1
-
-    while index > 0:
-        namespace = ".".join(segments[:index])
-        if namespace in logLevelsByNamespace:
-            return logLevelsByNamespace[namespace]
-        index -= 1
-
-    return logLevelsByNamespace[None]
-
-def setLogLevelForNamespace(namespace, level):
-    """
-    Sets the log level for a logging namespace.
-    @param namespace: a logging namespace
-    @param level: the log level for the given namespace.
-    """
-    if level not in logLevels:
-        raise InvalidLogLevelError(level)
-
-    if namespace:
-        logLevelsByNamespace[namespace] = level
-    else:
-        logLevelsByNamespace[None] = level
-
-def clearLogLevels():
-    """
-    Clears all log levels to the default.
-    """
-    logLevelsByNamespace.clear()
-    logLevelsByNamespace[None] = "warn"  # Default log level
-
-logLevelsByNamespace = {}
-clearLogLevels()
-
-##
-# Loggers
-##
-
-class Logger (object):
-    """
-    Logging object.
-    """
-    def __init__(self, namespace=None):
-        """
-        @param namespace: The namespace for this logger.  Uses a
-            dotted notation, as used by python modules.  If not
-            C{None}, then the name of the module of the caller
-            is used.
-        """
-        if namespace is None:
-            currentFrame = inspect.currentframe()
-            callerFrame  = currentFrame.f_back
-            callerModule = callerFrame.f_globals["__name__"]
-
-            namespace = callerModule
-
-        self.namespace = namespace
-
-    def __repr__(self):
-        return "<%s %r>" % (self.__class__.__name__, self.namespace)
-
-    def emit(self, level, message, **kwargs):
-        """
-        Called internally to emit log messages at a given log level.
-        """
-        assert level in logLevels, "Unknown log level: %r" % (level,)
-
-        logLevel = pythonLogLevelForLevel(level)
-
-        # FIXME: Filtering should be done by the log observer(s)
-        if not self.willLogAtLevel(level):
-            return
-
-        kwargs["level"] = level
-        kwargs["logLevel"] = logLevel
-        kwargs["namespace"] = self.namespace
-
-        log.msg(
-            # FIXME: This formatting should be done by the log observer(s)
-            "[%s#%s] %s" % (self.namespace, level, message),
-            **kwargs
-        )
-
-    def level(self):
-        """
-        @return: the logging level for this logger's namespace.
-        """
-        return logLevelForNamespace(self.namespace)
-
-    def setLevel(self, level):
-        """
-        Set the logging level for this logger's namespace.
-        @param level: a logging level
-        """
-        setLogLevelForNamespace(self.namespace, level)
-
-    def willLogAtLevel(self, level):
-        """
-        @param level: a logging level
-        @return: C{True} if this logger will log at the given logging
-            level.
-        """
-        return cmpLogLevels(self.level(), level) <= 0
-
-    # FIXME: This doesn't belong here
-    def logRequest(self, level, message, request, **kwargs):
-        """
-        Log an HTTP request.
-        """
-
-        assert level in logLevels
-
-        if self.willLogAtLevel(level):
-            iostr = StringIO()
-            iostr.write("%s\n" % (message,))
-            if hasattr(request, "clientproto"):
-                protocol = "HTTP/%d.%d" % (request.clientproto[0], request.clientproto[1],)
-            else:
-                protocol = "HTTP/1.1"
-            iostr.write("%s %s %s\n" % (request.method, request.uri, protocol,))
-            for name, valuelist in request.headers.getAllRawHeaders():
-                for value in valuelist:
-                    # Do not log authorization details
-                    if name not in ("Authorization",):
-                        iostr.write("%s: %s\n" % (name, value))
-                    else:
-                        iostr.write("%s: xxxxxxxxx\n" % (name,))
-            iostr.write("\n")
-            
-            # We need to play a trick with the request stream as we can only read it once. So we
-            # read it, store the value in a MemoryStream, and replace the request's stream with that,
-            # so the data can be read again.
-            def _gotData(data):
-                iostr.write(data)
-                
-                request.stream = MemoryStream(data if data is not None else "")
-                request.stream.doStartReading = None
-            
-                self.emit(level, iostr.getvalue(), **kwargs)
-
-            d = allDataFromStream(request.stream)
-            d.addCallback(_gotData)
-            return d
-        
-        else:
-            return succeed(None)
-    
-    # FIXME: This doesn't belong here
-    def logResponse(self, level, message, response, **kwargs):
-        """
-        Log an HTTP request.
-        """
-
-        assert level in logLevels
-
-        if self.willLogAtLevel(level):
-            iostr = StringIO()
-            iostr.write("%s\n" % (message,))
-            code_message = responsecode.RESPONSES.get(response.code, "Unknown Status")
-            iostr.write("HTTP/1.1 %s %s\n" % (response.code, code_message,))
-            for name, valuelist in response.headers.getAllRawHeaders():
-                for value in valuelist:
-                    # Do not log authorization details
-                    if name not in ("WWW-Authenticate",):
-                        iostr.write("%s: %s\n" % (name, value))
-                    else:
-                        iostr.write("%s: xxxxxxxxx\n" % (name,))
-            iostr.write("\n")
-            
-            # We need to play a trick with the response stream to ensure we don't mess it up. So we
-            # read it, store the value in a MemoryStream, and replace the response's stream with that,
-            # so the data can be read again.
-            def _gotData(data):
-                iostr.write(data)
-                
-                response.stream = MemoryStream(data if data is not None else "")
-                response.stream.doStartReading = None
-            
-                self.emit(level, iostr.getvalue(), **kwargs)
-                
-            d = allDataFromStream(response.stream)
-            d.addCallback(_gotData)
-            return d
-
-class LoggingMixIn (object):
-    """
-    Mix-in class for logging methods.
-    """
-    def _getLogger(self):
-        try:
-            return self._logger
-        except AttributeError:
-            self._logger = Logger(
-                "%s.%s" % (
-                    self.__class__.__module__,
-                    self.__class__.__name__,
-                )
-            )
-
-        return self._logger
-
-    def _setLogger(self, value):
-        self._logger = value
-
-    logger = property(_getLogger, _setLogger)
-
-for level in logLevels:
-    doc = """
-    Emit a log message at log level C{%s}.
-    @param message: The message to emit.
-    """ % (level,)
-
-    #
-    # Attach methods to Logger
-    #
-    def log_emit(self, message, __level__=level, raiseException=None, **kwargs):
-        self.emit(__level__, message, **kwargs)
-        if raiseException:
-            raise raiseException(message)
-
-    def will_emit(self, __level__=level):
-        return self.willLogAtLevel(__level__)
-
-    log_emit.__doc__ = doc
-
-    setattr(Logger, level, log_emit)
-    setattr(Logger, level + "_enabled", property(will_emit))
-
-    del log_emit
-    del will_emit
-
-    #
-    # Attach methods to LoggingMixIn
-    #
-    def log_emit(self, message, __level__=level, raiseException=None, **kwargs):
-        self.logger.emit(__level__, message, **kwargs)
-        if raiseException:
-            raise raiseException(message)
-
-    def will_emit(self=log_emit, __level__=level):
-        return self.logger.willLogAtLevel(__level__)
-
-    log_emit.__doc__ = doc
-    log_emit.enabled = will_emit
-
-    setattr(LoggingMixIn, "log_" + level, log_emit)
-    setattr(LoggingMixIn, "log_" + level + "_enabled", property(will_emit))
-
-    del log_emit
-    del will_emit
-
-del level
-
-# Add some compatibility with twisted's log module
-Logger.msg = Logger.info
-Logger.err = Logger.error
-
-##
-# Errors
-##
-
-class InvalidLogLevelError (RuntimeError):
-    def __init__(self, level):
-        super(InvalidLogLevelError, self).__init__(str(level))
-        self.level = level

Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,12 +20,22 @@
 """
 from __future__ import with_statement
 
-from calendarserver.provision.root import RootResource
+import datetime
+import email.utils
+import os
+import uuid
 
+try:
+    from cStringIO import StringIO
+except ImportError:
+    from StringIO import StringIO
+
 from email.mime.image import MIMEImage
 from email.mime.multipart import MIMEMultipart
 from email.mime.text import MIMEText
 
+from zope.interface import implements
+
 from twisted.application import internet, service
 from twisted.cred.portal import Portal
 from twisted.internet import protocol, defer, ssl, reactor
@@ -45,6 +55,8 @@
 from twisted.web2.http import Response, HTTPError
 from twisted.web2.http_headers import MimeType
 
+from twext.log import Logger, LoggingMixIn
+
 from twistedcaldav import ical, caldavxml
 from twistedcaldav import memcachepool
 from twistedcaldav.config import config
@@ -53,7 +65,6 @@
 from twistedcaldav.directory.util import NotFilePath
 from twistedcaldav.ical import Property
 from twistedcaldav.localization import translationTo
-from twistedcaldav.log import Logger, LoggingMixIn
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 from twistedcaldav.scheduling.scheduler import IMIPScheduler
 from twistedcaldav.sql import AbstractSQLDatabase
@@ -63,20 +74,9 @@
 from twistedcaldav.sql import AbstractSQLDatabase
 from twistedcaldav.localization import translationTo
 
-from zope.interface import implements
+from calendarserver.provision.root import RootResource
 
-import datetime
-import email.utils
-import os
-import uuid
 
-try:
-    from cStringIO import StringIO
-except ImportError:
-    from StringIO import StringIO
-
-
-
 __all__ = [
     "IMIPInboxResource",
     "MailGatewayServiceMaker",

Modified: CalendarServer/trunk/twistedcaldav/memcachepool.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcachepool.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/memcachepool.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -19,11 +19,9 @@
 from twisted.internet.defer import Deferred, fail
 from twisted.internet.protocol import ReconnectingClientFactory
 
+from twext.log import LoggingMixIn
 from twext.protocols.memcache import MemCacheProtocol, NoSuchCommand
 
-from twistedcaldav.log import LoggingMixIn
-
-
 class PooledMemCacheProtocol(MemCacheProtocol):
     """
     A MemCacheProtocol that will notify a connectionPool that it is ready

Modified: CalendarServer/trunk/twistedcaldav/memcacheprops.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcacheprops.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/memcacheprops.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -34,12 +34,13 @@
 
 from memcacheclient import ClientFactory as MemcacheClientFactory, MemcacheError, TokenMismatchError
 
+from twext.log import LoggingMixIn, Logger
+
 from twisted.python.filepath import FilePath
 from twisted.web2 import responsecode
 from twisted.web2.http import HTTPError, StatusResponse
 
 from twistedcaldav.config import config
-from twistedcaldav.log import LoggingMixIn, Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/memcacher.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcacher.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/memcacher.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,14 +14,16 @@
 # limitations under the License.
 ##
 
+import hashlib
+import cPickle
+import string
+
 from twisted.internet.defer import succeed
 
-from twistedcaldav.log import LoggingMixIn
+from twext.log import LoggingMixIn
+
 from twistedcaldav.memcachepool import CachePoolUserMixIn
 from twistedcaldav.config import config
-import hashlib
-import cPickle
-import string
 
 class Memcacher(LoggingMixIn, CachePoolUserMixIn):
 

Modified: CalendarServer/trunk/twistedcaldav/method/copymove.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/copymove.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/copymove.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -30,11 +30,12 @@
 from twisted.web2.dav.util import parentForURL
 from twisted.web2.http import StatusResponse, HTTPError
 
+from twext.log import Logger
+
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.method.put_common import StoreCalendarObjectResource
 from twistedcaldav.resource import isCalendarCollectionResource,\
     isPseudoCalendarCollectionResource
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/delete.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/delete.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/delete.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,6 +20,8 @@
 
 __all__ = ["http_DELETE"]
 
+from twext.log import Logger
+
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.web2 import responsecode
 from twisted.web2.dav import davxml
@@ -27,7 +29,6 @@
 from twisted.web2.http import HTTPError
 
 from twistedcaldav.method.delete_common import DeleteResource
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/delete_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/delete_common.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/delete_common.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -21,8 +21,6 @@
 
 __all__ = ["DeleteResource"]
 
-from twext.web2.dav.davxml import ErrorResponse
-
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.web2 import responsecode
 from twisted.web2.dav.fileop import delete
@@ -30,9 +28,11 @@
 from twisted.web2.dav.util import joinURL
 from twisted.web2.http import HTTPError, StatusResponse
 
+from twext.log import Logger
+from twext.web2.dav.davxml import ErrorResponse
+
 from twistedcaldav.caldavxml import caldav_namespace, ScheduleTag
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
 from twistedcaldav.method.report_common import applyToCalendarCollections
 from twistedcaldav.resource import isCalendarCollectionResource,\

Modified: CalendarServer/trunk/twistedcaldav/method/mkcalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/mkcalendar.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/mkcalendar.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,8 +20,6 @@
 
 __all__ = ["http_MKCALENDAR"]
 
-from twext.web2.dav.davxml import ErrorResponse
-
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.python.failure import Failure
 from twisted.web2 import responsecode
@@ -31,8 +29,10 @@
 from twisted.web2.dav.util import parentForURL
 from twisted.web2.http import HTTPError, StatusResponse
 
+from twext.log import Logger
+from twext.web2.dav.davxml import ErrorResponse
+
 from twistedcaldav import caldavxml
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/propfind.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/propfind.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/propfind.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -36,7 +36,7 @@
 from twisted.web2.dav.http import MultiStatusResponse, statusForFailure
 from twisted.web2.dav.util import normalizeURL, davXMLFromStream
 
-from twistedcaldav.log import Logger
+from twext.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/put.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/put.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -22,14 +22,15 @@
 
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.web2 import responsecode
-from twext.web2.dav.davxml import ErrorResponse
 from twisted.web2.dav.util import allDataFromStream, parentForURL
 from twisted.web2.http import HTTPError, StatusResponse
 
+from twext.log import Logger
+from twext.web2.dav.davxml import ErrorResponse
+
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.method.put_common import StoreCalendarObjectResource
 from twistedcaldav.resource import isPseudoCalendarCollectionResource
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -25,8 +25,6 @@
 import types
 import uuid
 
-from twext.web2.dav.davxml import ErrorResponse
-
 from twisted.internet import reactor
 from twisted.internet.defer import Deferred, inlineCallbacks, succeed
 from twisted.internet.defer import returnValue
@@ -46,6 +44,9 @@
 from twisted.web2.iweb import IResponse
 from twisted.web2.stream import MemoryStream
 
+from twext.log import Logger
+from twext.web2.dav.davxml import ErrorResponse
+
 from twistedcaldav.config import config
 from twistedcaldav.caldavxml import NoUIDConflict, ScheduleTag
 from twistedcaldav.caldavxml import NumberOfRecurrencesWithinLimits
@@ -61,7 +62,6 @@
 from twistedcaldav.index import ReservationError
 from twistedcaldav.instance import TooManyInstancesError,\
     InvalidOverriddenInstanceError
-from twistedcaldav.log import Logger
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
 from twistedcaldav.method.delete_common import DeleteResource
 from twistedcaldav.scheduling.implicit import ImplicitScheduler

Modified: CalendarServer/trunk/twistedcaldav/method/report.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/report.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -28,8 +28,6 @@
 
 import string
 
-from twext.web2.dav.davxml import ErrorResponse
-
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.web2 import responsecode
 from twisted.web2.http import HTTPError, StatusResponse
@@ -37,8 +35,10 @@
 from twisted.web2.dav.element.parser import lookupElement
 from twisted.web2.dav.util import davXMLFromStream
 
+from twext.log import Logger
+from twext.web2.dav.davxml import ErrorResponse
+
 from twistedcaldav import caldavxml
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/report_calquery.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_calquery.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/report_calquery.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -22,6 +22,7 @@
 
 import urllib
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import succeed, inlineCallbacks, returnValue
@@ -38,7 +39,6 @@
 from twistedcaldav.customxml import TwistedCalendarAccessProperty
 from twistedcaldav.index import IndexedSearchException
 from twistedcaldav.instance import TooManyInstancesError
-from twistedcaldav.log import Logger
 from twistedcaldav.method import report_common
 
 log = Logger()

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -50,6 +50,8 @@
 from twisted.web2.dav.resource import AccessDeniedError
 from twisted.web2.http import HTTPError
 
+from twext.log import Logger
+
 from twistedcaldav import caldavxml
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.customxml import TwistedCalendarAccessProperty
@@ -57,7 +59,6 @@
 from twistedcaldav.ical import Component, Property, iCalendarProductID
 from twistedcaldav.instance import InstanceList
 from twistedcaldav.index import IndexedSearchException
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/report_freebusy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_freebusy.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/report_freebusy.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,6 +20,7 @@
 
 __all__ = ["report_urn_ietf_params_xml_ns_caldav_free_busy_query"]
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -32,7 +33,6 @@
 
 from twistedcaldav import caldavxml
 from twistedcaldav.method import report_common
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -22,6 +22,7 @@
 
 from urllib import unquote
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -34,7 +35,6 @@
 
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.method import report_common
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,6 +20,7 @@
 
 __all__ = ["report_DAV__sync_collection"]
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse, SyncToken
 
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -34,7 +35,6 @@
 from twisted.web2.http import HTTPError
 
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 
 import functools
 

Modified: CalendarServer/trunk/twistedcaldav/notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notify.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/notify.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -34,6 +34,13 @@
 
 # TODO: add CalDAVTester test for examining new xmpp-uri property
 
+import uuid
+from fnmatch import fnmatch
+
+from zope.interface import Interface, implements
+
+from twext.log import LoggingMixIn
+
 from twisted.internet.protocol import ReconnectingClientFactory, ServerFactory
 from twisted.internet.address import IPv4Address
 from twisted.internet.ssl import ClientContextFactory
@@ -48,14 +55,10 @@
 from twisted.words.protocols.jabber.client import XMPPAuthenticator, IQAuthInitializer
 from twisted.words.protocols.jabber.xmlstream import IQ
 from twisted.words.xish import domish
-from twistedcaldav.log import LoggingMixIn
 from twistedcaldav.config import config
 from twistedcaldav.memcacher import Memcacher
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
 from twistedcaldav import memcachepool
-from zope.interface import Interface, implements
-from fnmatch import fnmatch
-import uuid
 
 __all__ = [
     "ClientNotifier",

Modified: CalendarServer/trunk/twistedcaldav/partitions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/partitions.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/partitions.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,9 +14,10 @@
 # limitations under the License.
 ##
 
+from twext.log import Logger
 from twext.python.plistlib import readPlist
+
 from twistedcaldav.client.pool import installPool
-from twistedcaldav.log import Logger
 
 """
 Collection of classes for managing partition information for a group of servers.

Modified: CalendarServer/trunk/twistedcaldav/pdmonster.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/pdmonster.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/pdmonster.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -4,7 +4,7 @@
 
 from twisted.web2.resource import WrapperResource
 
-from twistedcaldav.log import LoggingMixIn
+from twext.log import LoggingMixIn
 
 class PDClientAddressWrapper(WrapperResource, LoggingMixIn):
     def __init__(self, resource, socket, directory):

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -28,9 +28,11 @@
 ]
 
 import urllib
+from urlparse import urlsplit
 
 from zope.interface import implements
 
+from twext.log import LoggingMixIn
 from twext.web2.dav.davxml import ErrorResponse, SyncCollection
 
 from twisted.internet import reactor
@@ -61,10 +63,7 @@
 from twistedcaldav.ical import Component as iComponent
 from twistedcaldav.ical import allowedComponents
 from twistedcaldav.icaldav import ICalDAVResource, ICalendarPrincipalResource
-from twistedcaldav.log import LoggingMixIn
 
-from urlparse import urlsplit
-
 if twistedcaldav.__version__:
     serverVersion = twisted.web2.server.VERSION + " TwistedCalDAV/" + twistedcaldav.__version__
 else:

Modified: CalendarServer/trunk/twistedcaldav/scheduling/addressmapping.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/addressmapping.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/addressmapping.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,8 +14,11 @@
 # limitations under the License.
 ##
 
+from twisted.internet.defer import inlineCallbacks, returnValue
+
+from twext.log import Logger
+
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 from twistedcaldav.memcacher import Memcacher
 from twistedcaldav.scheduling.caldav import ScheduleViaCalDAV
 from twistedcaldav.scheduling.delivery import DeliveryService
@@ -24,7 +27,6 @@
 from twistedcaldav.scheduling.cuaddress import LocalCalendarUser,\
     RemoteCalendarUser, EmailCalendarUser, InvalidCalendarUser,\
     PartitionedCalendarUser
-from twisted.internet.defer import inlineCallbacks, returnValue
 
 __all__ = [
     "ScheduleAddressMapper",

Modified: CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -21,6 +21,7 @@
 except ImportError:
     from md5 import new as md5
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -35,7 +36,6 @@
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.config import config
 from twistedcaldav.customxml import calendarserver_namespace
-from twistedcaldav.log import Logger
 from twistedcaldav.method import report_common
 from twistedcaldav.resource import isCalendarCollectionResource
 from twistedcaldav.scheduling.cuaddress import LocalCalendarUser, RemoteCalendarUser,\

Modified: CalendarServer/trunk/twistedcaldav/scheduling/cuaddress.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/cuaddress.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/cuaddress.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,7 +14,8 @@
 # limitations under the License.
 ##
 
-from twistedcaldav.log import Logger
+from twext.log import Logger
+
 from twistedcaldav.scheduling.delivery import DeliveryService
 
 __all__ = [

Modified: CalendarServer/trunk/twistedcaldav/scheduling/delivery.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/delivery.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/delivery.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,11 +14,12 @@
 # limitations under the License.
 ##
 
+import re
+
+from twext.log import Logger
+
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 
-import re
-
 __all__ = [
     "DeliveryService",
 ]

Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,11 +14,12 @@
 # limitations under the License.
 ##
 
+from twext.log import Logger
+
 from twistedcaldav.config import config
 from twistedcaldav.dateops import normalizeToUTC, toString,\
     normalizeStartEndDuration
 from twistedcaldav.ical import Component, Property
-from twistedcaldav.log import Logger
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 from twistedcaldav.scheduling.itip import iTipGenerator
 from twistedcaldav import accounting

Modified: CalendarServer/trunk/twistedcaldav/scheduling/imip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/imip.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/imip.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,10 +14,10 @@
 # limitations under the License.
 ##
 
+from twisted.python.failure import Failure
 from twisted.internet.defer import inlineCallbacks, returnValue
 
-from twisted.python.failure import Failure
-
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.web2 import responsecode
@@ -26,7 +26,6 @@
 
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 from twistedcaldav.util import AuthorizedHTTPGetter
 from twistedcaldav.scheduling.delivery import DeliveryService
 from twistedcaldav.scheduling.itip import iTIPRequestStatus

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,6 +14,7 @@
 # limitations under the License.
 ##
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -28,7 +29,6 @@
 from twistedcaldav.customxml import TwistedSchedulingObjectResource
 from twistedcaldav.directory.principal import DirectoryCalendarPrincipalResource
 from twistedcaldav.ical import Property
-from twistedcaldav.log import Logger
 from twistedcaldav.method import report_common
 from twistedcaldav.scheduling import addressmapping
 from twistedcaldav.scheduling.cuaddress import InvalidCalendarUser,\

Modified: CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/ischedule.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,9 +14,9 @@
 # limitations under the License.
 ##
 
-from twext.web2.dav.davxml import ErrorResponse
+from StringIO import StringIO
 
-from twisted.internet.defer import inlineCallbacks, DeferredList
+from twisted.internet.defer import inlineCallbacks, DeferredList, succeed
 from twisted.internet.protocol import ClientCreator
 
 from twisted.python.failure import Failure
@@ -24,24 +24,26 @@
 from twisted.web2 import responsecode
 from twisted.web2.client.http import ClientRequest
 from twisted.web2.client.http import HTTPClientProtocol
-from twisted.web2.dav.util import davXMLFromStream, joinURL
+from twisted.web2.dav.util import davXMLFromStream, joinURL, allDataFromStream
 from twisted.web2.http import HTTPError
 from twisted.web2.http_headers import Headers
 from twisted.web2.http_headers import MimeType
+from twisted.web2.stream import MemoryStream
 
+from twext.log import Logger, logLevels
 from twext.internet.ssl import ChainingOpenSSLContextFactory
+from twext.web2.dav.davxml import ErrorResponse
 
 from twistedcaldav import caldavxml
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 from twistedcaldav.scheduling.delivery import DeliveryService
-from twistedcaldav.scheduling.ischeduleservers import IScheduleServers,\
-    IScheduleServerRecord
+from twistedcaldav.scheduling.ischeduleservers import IScheduleServers
+from twistedcaldav.scheduling.ischeduleservers import IScheduleServerRecord
 from twistedcaldav.scheduling.itip import iTIPRequestStatus
 from twistedcaldav.util import utf8String
-from twistedcaldav.scheduling.cuaddress import RemoteCalendarUser,\
-    PartitionedCalendarUser
+from twistedcaldav.scheduling.cuaddress import RemoteCalendarUser
+from twistedcaldav.scheduling.cuaddress import PartitionedCalendarUser
 
 import OpenSSL
 
@@ -170,6 +172,83 @@
                 err = HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "recipient-failed")))
                 self.responses.add(recipient.cuaddr, Failure(exc_value=err), reqstatus=iTIPRequestStatus.SERVICE_UNAVAILABLE)
 
+    def logRequest(self, level, message, request, **kwargs):
+        """
+        Log an HTTP request.
+        """
+
+        assert level in logLevels
+
+        if self.willLogAtLevel(level):
+            iostr = StringIO()
+            iostr.write("%s\n" % (message,))
+            if hasattr(request, "clientproto"):
+                protocol = "HTTP/%d.%d" % (request.clientproto[0], request.clientproto[1],)
+            else:
+                protocol = "HTTP/1.1"
+            iostr.write("%s %s %s\n" % (request.method, request.uri, protocol,))
+            for name, valuelist in request.headers.getAllRawHeaders():
+                for value in valuelist:
+                    # Do not log authorization details
+                    if name not in ("Authorization",):
+                        iostr.write("%s: %s\n" % (name, value))
+                    else:
+                        iostr.write("%s: xxxxxxxxx\n" % (name,))
+            iostr.write("\n")
+            
+            # We need to play a trick with the request stream as we can only read it once. So we
+            # read it, store the value in a MemoryStream, and replace the request's stream with that,
+            # so the data can be read again.
+            def _gotData(data):
+                iostr.write(data)
+                
+                request.stream = MemoryStream(data if data is not None else "")
+                request.stream.doStartReading = None
+            
+                self.emit(level, iostr.getvalue(), **kwargs)
+
+            d = allDataFromStream(request.stream)
+            d.addCallback(_gotData)
+            return d
+        
+        else:
+            return succeed(None)
+    
+    def logResponse(self, level, message, response, **kwargs):
+        """
+        Log an HTTP request.
+        """
+        assert level in logLevels
+
+        if self.willLogAtLevel(level):
+            iostr = StringIO()
+            iostr.write("%s\n" % (message,))
+            code_message = responsecode.RESPONSES.get(response.code, "Unknown Status")
+            iostr.write("HTTP/1.1 %s %s\n" % (response.code, code_message,))
+            for name, valuelist in response.headers.getAllRawHeaders():
+                for value in valuelist:
+                    # Do not log authorization details
+                    if name not in ("WWW-Authenticate",):
+                        iostr.write("%s: %s\n" % (name, value))
+                    else:
+                        iostr.write("%s: xxxxxxxxx\n" % (name,))
+            iostr.write("\n")
+            
+            # We need to play a trick with the response stream to ensure we don't mess it up. So we
+            # read it, store the value in a MemoryStream, and replace the response's stream with that,
+            # so the data can be read again.
+            def _gotData(data):
+                iostr.write(data)
+                
+                response.stream = MemoryStream(data if data is not None else "")
+                response.stream.doStartReading = None
+            
+                self.emit(level, iostr.getvalue(), **kwargs)
+                
+            d = allDataFromStream(response.stream)
+            d.addCallback(_gotData)
+            return d
+
     def _generateHeaders(self):
         self.headers = Headers()
         self.headers.setHeader('Host', utf8String(self.server.host + ":%s" % (self.server.port,)))

Modified: CalendarServer/trunk/twistedcaldav/scheduling/ischeduleservers.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/ischeduleservers.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/ischeduleservers.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -16,8 +16,9 @@
 
 from twisted.python.filepath import FilePath
 
+from twext.log import Logger
+
 from twistedcaldav.config import config
-from twistedcaldav.log import Logger
 from twistedcaldav.scheduling.delivery import DeliveryService
 
 import xml.dom.minidom

Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -32,14 +32,15 @@
 
 import datetime
 
+from vobject.icalendar import utc
+from vobject.icalendar import dateTimeToString
+
+from twext.log import Logger
+
 from twistedcaldav.config import config
 from twistedcaldav.dateops import normalizeToUTC, toString
-from twistedcaldav.log import Logger
 from twistedcaldav.ical import Property, iCalendarProductID, Component
 
-from vobject.icalendar import utc
-from vobject.icalendar import dateTimeToString
-
 log = Logger()
 
 __version__ = "0.0"

Modified: CalendarServer/trunk/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,7 +14,14 @@
 # limitations under the License.
 ##
 
+import datetime
+import time
 from hashlib import md5
+
+from vobject.icalendar import utc
+
+from twext.log import Logger
+
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.web2.dav.method.report import NumberOfMatchesWithinLimits
@@ -24,15 +31,11 @@
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.ical import Property
 from twistedcaldav.instance import InvalidOverriddenInstanceError
-from twistedcaldav.log import Logger
 from twistedcaldav.method import report_common
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 from twistedcaldav.scheduling.itip import iTipProcessing, iTIPRequestStatus
 from twistedcaldav.scheduling.utils import getCalendarObjectForPrincipals
-from vobject.icalendar import utc
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
-import datetime
-import time
 
 __all__ = [
     "ImplicitProcessor",

Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -14,12 +14,11 @@
 # limitations under the License.
 ##
 
+from twext.log import Logger, LoggingMixIn
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import inlineCallbacks, returnValue
-
 from twisted.python.failure import Failure
-
 from twisted.web2 import responsecode
 from twisted.web2.dav import davxml
 from twisted.web2.dav.http import errorForFailure, messageForFailure, statusForFailure
@@ -32,7 +31,6 @@
 from twistedcaldav.config import config
 from twistedcaldav.customxml import calendarserver_namespace
 from twistedcaldav.ical import Component
-from twistedcaldav.log import Logger, LoggingMixIn
 from twistedcaldav.scheduling import addressmapping
 from twistedcaldav.scheduling.caldav import ScheduleViaCalDAV
 from twistedcaldav.scheduling.cuaddress import InvalidCalendarUser,\

Modified: CalendarServer/trunk/twistedcaldav/sql.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sql.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/sql.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -31,7 +31,7 @@
 except ImportError:
     from pysqlite2 import dbapi2 as sqlite
 
-from twistedcaldav.log import Logger
+from twext.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/static.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -40,6 +40,7 @@
 from urlparse import urlsplit
 from uuid import uuid4
 
+from twext.log import Logger
 from twext.web2.dav.davxml import ErrorResponse
 
 from twisted.internet.defer import fail, succeed, inlineCallbacks, returnValue, maybeDeferred
@@ -78,7 +79,6 @@
 from twistedcaldav.directory.calendar import DirectoryCalendarHomeUIDProvisioningResource
 from twistedcaldav.directory.calendar import DirectoryCalendarHomeResource
 from twistedcaldav.directory.resource import AutoProvisioningResourceMixIn
-from twistedcaldav.log import Logger
 from twistedcaldav.timezoneservice import TimezoneServiceResource
 from twistedcaldav.cache import DisabledCacheNotifier, PropfindCacheMixin
 from twistedcaldav.notify import getPubSubConfiguration, getPubSubXMPPURI

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -23,14 +23,14 @@
 from twisted.web2.dav.resource import TwistedACLInheritable
 
 from twext.python.plistlib import PlistParser
+from twext.log import Logger, InvalidLogLevelError
+from twext.log import clearLogLevels, setLogLevelForNamespace
 
-from twistedcaldav.config import (
-    ConfigProvider, ConfigurationError, config, _mergeData, )
-from twistedcaldav.log import (
-    Logger, clearLogLevels, setLogLevelForNamespace, InvalidLogLevelError, )
+from twistedcaldav.config import ConfigProvider, ConfigurationError
+from twistedcaldav.config import config, _mergeData
 from twistedcaldav.partitions import partitions
-from twistedcaldav.util import (
-    KeychainAccessError, KeychainPasswordNotFound, getPasswordFromKeychain, )
+from twistedcaldav.util import getPasswordFromKeychain
+from twistedcaldav.util import KeychainAccessError, KeychainPasswordNotFound
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_config.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/test/test_config.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -15,8 +15,8 @@
 ##
 
 from twext.python.plistlib import writePlist
+from twext.log import logLevelForNamespace
 
-from twistedcaldav.log import logLevelForNamespace
 from twistedcaldav.config import config, ConfigDict
 from twistedcaldav.static import CalDAVFile
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, PListConfigProvider

Modified: CalendarServer/trunk/twistedcaldav/test/test_log.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_log.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/test/test_log.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -18,7 +18,8 @@
 
 from twisted.python import log as twistedLogging
 
-from twistedcaldav.log import *
+from twext.log import *
+
 from twistedcaldav.test.util import TestCase
 
 defaultLogLevel = logLevelsByNamespace[None]

Modified: CalendarServer/trunk/twistedcaldav/timezones.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/timezones.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/timezones.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -20,8 +20,9 @@
 from vobject.icalendar import getTzid
 from vobject.icalendar import registerTzid
 
+from twext.log import Logger
+
 from twistedcaldav.ical import Component
-from twistedcaldav.log import Logger
 
 log = Logger()
 

Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -17,20 +17,23 @@
 
 from __future__ import with_statement
 
+import xattr, os, zlib, hashlib, datetime, pwd, grp, shutil
+from zlib import compress
+from cPickle import loads as unpickle, UnpicklingError
+
 from twisted.web2.dav.fileop import rmdir
 from twisted.web2.dav import davxml
+
+from twext.log import Logger
+
 from twistedcaldav.directory.directory import DirectoryService
 from twistedcaldav.directory.resourceinfo import ResourceInfoDatabase
 from twistedcaldav.mail import MailGatewayTokensDatabase
-from twistedcaldav.log import Logger
 from twistedcaldav.ical import Component
 from twistedcaldav import caldavxml
+
 from calendarserver.tools.util import getDirectory
-import xattr, os, zlib, hashlib, datetime, pwd, grp, shutil
-from zlib import compress
-from cPickle import loads as unpickle, UnpicklingError
 
-
 log = Logger()
 
 def getCalendarServerIDs(config):

Modified: CalendarServer/trunk/twistedcaldav/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/util.py	2010-01-28 21:39:52 UTC (rev 4972)
+++ CalendarServer/trunk/twistedcaldav/util.py	2010-01-29 01:14:53 UTC (rev 4973)
@@ -17,14 +17,15 @@
 import os
 import re
 import sys
+import base64
+
 from subprocess import Popen, PIPE, STDOUT
+from hashlib import md5, sha1
 
 from twisted.internet import ssl, reactor
 from twisted.web import client
-from twistedcaldav.log import LoggingMixIn
 from twisted.python import failure
-from hashlib import md5, sha1
-import base64
+from twext.log import LoggingMixIn
 
 ##
 # getNCPU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100128/9d68e32f/attachment-0001.html>


More information about the calendarserver-changes mailing list