Mercurial > p > roundup > code
diff roundup/instance.py @ 2397:fa50e1347397
added basic logging support
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 08 Jun 2004 05:29:18 +0000 |
| parents | c77483d2cda4 |
| children | eeadb59213d8 |
line wrap: on
line diff
--- a/roundup/instance.py Sun Jun 06 13:50:36 2004 +0000 +++ b/roundup/instance.py Tue Jun 08 05:29:18 2004 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: instance.py,v 1.13 2004-05-10 00:34:48 richard Exp $ +# $Id: instance.py,v 1.14 2004-06-08 05:29:18 richard Exp $ '''Tracker handling (open tracker). @@ -24,6 +24,7 @@ __docformat__ = 'restructuredtext' import os +from roundup import rlog class Vars: ''' I'm just a container ''' @@ -91,6 +92,24 @@ raise TrackerError, \ 'Required tracker attribute "%s" missing'%required + # init the logging + config = tracker.config + if hasattr(config, 'LOGGING_CONFIG'): + try: + import logging + config.logging = logging + except ImportError, msg: + raise TrackerError, 'Python logging module unavailable: %s'%msg + config.logging.fileConfig(config.LOGGING_CONFIG) + elif hasattr(config, 'LOGGING_FILENAME'): + config.logging = rlog.BasicLogging() + config.logging.setFile(config.LOGGING_FILENAME) + if hasattr(config, 'LOGGING_LEVEL'): + config.logging.setLevel(config.LOGGING_LEVEL) + else: + config.logging = rlog.BasicLogging() + config.logging.setLevel('ERROR') + return tracker OldStyleTrackers = OldStyleTrackers()
