[CalendarServer-changes] [2350] CalendarServer/branches/users/wsanchez/logging/twistedcaldav/log.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 25 17:23:44 PDT 2008


Revision: 2350
          http://trac.macosforge.org/projects/calendarserver/changeset/2350
Author:   wsanchez at apple.com
Date:     2008-04-25 17:23:44 -0700 (Fri, 25 Apr 2008)

Log Message:
-----------
raise new InvalidLogLevelError instead of assert

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/logging/twistedcaldav/log.py

Modified: CalendarServer/branches/users/wsanchez/logging/twistedcaldav/log.py
===================================================================
--- CalendarServer/branches/users/wsanchez/logging/twistedcaldav/log.py	2008-04-25 00:17:10 UTC (rev 2349)
+++ CalendarServer/branches/users/wsanchez/logging/twistedcaldav/log.py	2008-04-26 00:23:44 UTC (rev 2350)
@@ -103,7 +103,8 @@
     @param namespace: a logging namespace
     @param level: the log level for the given namespace.
     """
-    assert level in logLevels
+    if level not in logLevels:
+        raise InvalidLogLevelError(level)
 
     if not namespace:
         global defaultLogLevel
@@ -208,3 +209,12 @@
 # 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080425/b5f1ac5f/attachment.html


More information about the calendarserver-changes mailing list