[Zope-CVS] SVN: PluggableAuthService/trunk/ - Convert from using zLOG to using the Python logging module.

Jens Vagelpohl jens at dataflake.org
Sat Feb 25 14:58:28 EST 2006


Log message for revision 65464:
  - Convert from using zLOG to using the Python logging module.
    (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/14)
  

Changed:
  U   PluggableAuthService/trunk/PluggableAuthService.py
  U   PluggableAuthService/trunk/doc/CHANGES.txt

-=-
Modified: PluggableAuthService/trunk/PluggableAuthService.py
===================================================================
--- PluggableAuthService/trunk/PluggableAuthService.py	2006-02-25 19:57:08 UTC (rev 65463)
+++ PluggableAuthService/trunk/PluggableAuthService.py	2006-02-25 19:58:27 UTC (rev 65464)
@@ -17,7 +17,10 @@
 $Id$
 """
 
-import sys, re, types
+import logging
+import sys
+import re
+import types
 
 from ZPublisher import BeforeTraverse
 
@@ -33,7 +36,6 @@
 
 from App.ImageFile import ImageFile
 
-from zLOG import LOG, BLATHER
 from zExceptions import Unauthorized
 from Persistence import PersistentMapping
 from OFS.Folder import Folder
@@ -88,6 +90,8 @@
 security = ModuleSecurityInfo(
     'Products.PluggableAuthService.PluggableAuthService' )
 
+logger = logging.getLogger('PluggableAuthService')
+
 #   Errors which plugins may raise, and which we suppress:
 _SWALLOWABLE_PLUGIN_EXCEPTIONS = ( NameError
                                  , AttributeError
@@ -310,9 +314,9 @@
                     result.append(info)
 
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                LOG('PluggableAuthService', BLATHER,
-                    'UserEnumerationPlugin %s error' % enumerator_id,
-                    error=sys.exc_info())
+                logger.debug( 'UserEnumerationPlugin %s error' % enumerator_id
+                            , exc_info=True
+                            )
 
         if sort_by:
             result.sort( lambda a, b: cmp( a.get(sort_by, '').lower()
@@ -366,9 +370,9 @@
                         info[ 'title' ] = "(Group) %s" % info[ 'groupid' ]
                     result.append(info)
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                LOG('PluggableAuthService', BLATHER,
-                    'GroupEnumerationPlugin %s error' % enumerator_id,
-                    error=sys.exc_info())
+                logger.debug( 'GroupEnumerationPlugin %s error' % enumerator_id
+                            , exc_info=True
+                            )
 
         if sort_by:
             result.sort( lambda a, b: cmp( a.get(sort_by, '').lower()
@@ -538,9 +542,7 @@
         try:
             extractors = plugins.listPlugins( IExtractionPlugin )
         except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-            LOG('PluggableAuthService', BLATHER,
-                'Plugin listing error',
-                error=sys.exc_info())
+            logger.debug('Extractor plugin listing error', exc_info=True)
             extractors = ()
 
         if not extractors:
@@ -549,9 +551,7 @@
         try:
             authenticators = plugins.listPlugins( IAuthenticationPlugin )
         except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-            LOG('PluggableAuthService', BLATHER,
-                'Plugin listing error',
-                error=sys.exc_info())
+            logger.debug('Authenticator plugin listing error', exc_info=True)
             authenticators = ()
 
         for extractor_id, extractor in extractors:
@@ -559,9 +559,9 @@
             try:
                 credentials = extractor.extractCredentials( request )
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                LOG('PluggableAuthService', BLATHER,
-                    'ExtractionPlugin %s error' % extractor_id,
-                    error=sys.exc_info())
+                logger.debug( 'ExtractionPlugin %s error' % extractor_id
+                            , exc_info=True
+                            )
                 continue
 
             if credentials:
@@ -571,9 +571,9 @@
                     items = credentials.items()
                     items.sort()
                 except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                    LOG('PluggableAuthService', BLATHER,
-                        'Credentials error: %s' % credentials,
-                        error=sys.exc_info())
+                    logger.debug( 'Credentials error: %s' % credentials
+                                , exc_info=True
+                                )
                 else:
                     user_ids = []
 
@@ -599,9 +599,9 @@
                             user_id, info = uid_and_info
 
                         except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                            LOG('PluggableAuthService', BLATHER,
-                                'AuthenticationPlugin %s error' %
-                                authenticator_id, error=sys.exc_info())
+                            msg = 'AuthenticationPlugin %s error' % ( 
+                                    authenticator_id, )
+                            logger.debug(msg, exc_info=True) 
                             continue
 
                         if user_id is not None:
@@ -627,9 +627,7 @@
             eua = EmergencyUserAuthenticator()
             user_id, name = eua.authenticateCredentials( credentials )
         except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-            LOG('PluggableAuthService', BLATHER,
-                'Credentials error: %s' % credentials,
-                error=sys.exc_info())
+            logger.debug('Credentials error: %s' % credentials, exc_info=True)
             user_id, name = ( None, None )
 
         return ( user_id, name )
@@ -787,9 +785,8 @@
                         return info[0]
 
                 except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                    LOG('PluggableAuthService', BLATHER,
-                        'UserEnumerationPlugin %s error' % enumerator_id,
-                        error=sys.exc_info())
+                    msg = 'UserEnumerationPlugin %s error' % enumerator_id
+                    logger.debug(msg, exc_info=True)
 
         return None
 
@@ -939,9 +936,9 @@
                 try:
                     roleassigner.doAssignRoleToPrincipal( user.getId(), role )
                 except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
-                    LOG('PluggableAuthService', BLATHER,
-                        'RoleAssigner %s error' % roleassigner_id,
-                        error=sys.exc_info())
+                    logger.debug( 'RoleAssigner %s error' % roleassigner_id
+                                , exc_info=True
+                                )
                     pass
 
     security.declarePublic('all_meta_types')

Modified: PluggableAuthService/trunk/doc/CHANGES.txt
===================================================================
--- PluggableAuthService/trunk/doc/CHANGES.txt	2006-02-25 19:57:08 UTC (rev 65463)
+++ PluggableAuthService/trunk/doc/CHANGES.txt	2006-02-25 19:58:27 UTC (rev 65464)
@@ -20,7 +20,10 @@
         constrain searches by ID.
         (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/11)
 
+      - Convert from using zLOG to using the Python logging module.
+        (http://www.zope.org/Members/urbanape/PluggableAuthService/Collector/14)
 
+
   PluggableAuthService 1.2-beta (2006/02/25)
 
     New Features



More information about the Zope-CVS mailing list