Changeset 6481 for main/waeup.sirp/trunk


Ignore:
Timestamp:
27 Jun 2011, 10:31:10 (14 years ago)
Author:
uli
Message:

Move logger interfaces to final destination.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py

    r6478 r6481  
    2727from hurry.query.interfaces import IQuery
    2828from zope.component import getUtility
    29 from waeup.sirp.interfaces import IWAeUPSIRPPluggable
    30 from waeup.sirp.utils.logger import ISiteLoggers
     29from waeup.sirp.interfaces import IWAeUPSIRPPluggable, ISiteLoggers
    3130from waeup.sirp.applicants.interfaces import IApplicantsRoot
    3231from waeup.sirp.utils.helpers import get_current_principal
     
    5958        else:
    6059            user = user.id
    61         self.logger.info('%s - %s - %s  - %s' % (user, target, ob_class, comment))
     60        self.logger.info('%s - %s - %s  - %s' % (
     61                user, target, ob_class, comment))
    6262
    6363class ApplicantsPlugin(grok.GlobalUtility):
  • main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py

    r6361 r6481  
    448448        """
    449449        pass
     450
     451class ISiteLoggers(Interface):
     452
     453    loggers = Attribute("A list or generator of registered WAeUPLoggers")
     454
     455    def register(name, filename=None, site=None, **options):
     456        """Register a logger `name` which logs to `filename`.
     457
     458        If `filename` is not given, logfile will be `name` with
     459        ``.log`` as filename extension.
     460        """
     461
     462    def unregister(name):
     463        """Unregister a once registered logger.
     464        """
     465
     466class ILogger(Interface):
     467    """A logger cares for setup, update and restarting of a Python logger.
     468    """
     469
     470    logger = Attribute("""A :class:`logging.Logger` instance""")
     471
     472
     473    def __init__(name, filename=None, site=None, **options):
     474        """Create a WAeUP logger instance.
     475        """
     476        pass
     477
     478    def setup():
     479        """Create a Python :class:`logging.Logger` instance.
     480
     481        The created logger is based on the params given by constructor.
     482        """
     483        pass
     484
     485    def update(**options):
     486        """Update the logger.
     487
     488        Updates the logger respecting modified `options` and changed
     489        paths.
     490        """
     491
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/logger.py

    r6480 r6481  
    2727import logging
    2828from zope.interface import Interface, Attribute
    29 
    30 class ISiteLoggers(Interface):
    31 
    32     loggers = Attribute("A list or generator of registered WAeUPLoggers")
    33 
    34     def register(name, filename=None, site=None, **options):
    35         """Register a logger `name` which logs to `filename`.
    36 
    37         If `filename` is not given, logfile will be `name` with
    38         ``.log`` as filename extension.
    39         """
    40 
    41     def unregister(name):
    42         """Unregister a once registered logger.
    43         """
     29from waeup.sirp.interfaces import ISiteLoggers, ILogger
    4430
    4531class SiteLoggers(object):
     
    7258    def keys(self):
    7359        return self._loggers.keys()
    74 
    75 class ILogger(Interface):
    76     """A logger cares for setup, update and restarting of a Python logger.
    77     """
    78 
    79     logger = Attribute("""A :class:`logging.Logger` instance""")
    80 
    81 
    82     def __init__(name, filename=None, site=None, **options):
    83         """Create a WAeUP logger instance.
    84         """
    85         pass
    86 
    87     def setup():
    88         """Create a Python :class:`logging.Logger` instance.
    89 
    90         The created logger is based on the params given by constructor.
    91         """
    92         pass
    93 
    94     def update(**options):
    95         """Update the logger.
    96 
    97         Updates the logger respecting modified `options` and changed
    98         paths.
    99         """
    10060
    10161class WAeUPLogger(object):
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_logger.py

    r6440 r6481  
    3030from zope.interface.verify import verifyClass, verifyObject
    3131from waeup.sirp.app import University
     32from waeup.sirp.interfaces import ISiteLoggers, ILogger
    3233from waeup.sirp.testing import FunctionalLayer, doctestsuite_for_module
    3334from waeup.sirp.utils.logger import (
    34     ISiteLoggers, ILogger, SiteLoggers, WAeUPLogger, SiteLoggersRepository)
     35    SiteLoggers, WAeUPLogger, SiteLoggersRepository)
    3536
    3637class SiteLoggersTests(FunctionalTestCase):
Note: See TracChangeset for help on using the changeset viewer.