[csw-devel] SF.net SVN: gar:[13478] csw/mgar/gar/v2/lib/python/uwatch.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Feb 27 01:36:58 CET 2011


Revision: 13478
          http://gar.svn.sourceforge.net/gar/?rev=13478&view=rev
Author:   wahwah
Date:     2011-02-27 00:36:58 +0000 (Sun, 27 Feb 2011)

Log Message:
-----------
uwatch: Add logging module support

A lot of code in uwatch needs to be ported to the logging module.

Signed-off-by: Maciej Blizinski <maciej at opencsw.org>

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/uwatch.py

Modified: csw/mgar/gar/v2/lib/python/uwatch.py
===================================================================
--- csw/mgar/gar/v2/lib/python/uwatch.py	2011-02-27 00:36:27 UTC (rev 13477)
+++ csw/mgar/gar/v2/lib/python/uwatch.py	2011-02-27 00:36:58 UTC (rev 13478)
@@ -45,6 +45,7 @@
 import MySQLdb
 import datetime
 import ConfigParser
+import logging
 
 from urllib2 import Request, urlopen, URLError
 from optparse import OptionParser
@@ -274,10 +275,13 @@
                 self._uwatch_pkg_root = None
 
         # This member variable is a flag which defines the status of the verbose mode (True : activated)
-        if args.verbose != None:
+        logging_level = logging.INFO
+        if args.verbose is not None:
             self._verbose = args.verbose
+            logging_level = logging.DEBUG
         else:
             self._verbose = False
+        logging.basicConfig(level=logging_level)
 
         # This member variable defines the value of the version of the package
         # Current revision is not passed as a separated argument. It is part of the opencsw version number. 
@@ -726,6 +730,8 @@
             # Search the strings matching the regexp passed through command line arguments
             p = re.compile(self.config.getRegexp())
             matches = p.findall(content)
+            logging.info("CheckUpstreamCommand.execute(): matches=%s",
+                         repr(matches))
 
             # Check if we have found some results
             if len(matches) == 0:
@@ -811,8 +817,15 @@
             content = self.UrlContentRetrieve(self.config.getUpstreamURL())
 
             # Search the strings matching the regexp passed through command line arguments
-            p = re.compile(self.config.getRegexp())
+            regex_str = self.config.getRegexp()
+            p = re.compile(regex_str)
             matches = p.findall(content)
+            logging.info("GetUpstreamLatestVersionCommand.execute(): "
+                         "regex=%s",
+                         repr(regex_str))
+            logging.info("GetUpstreamLatestVersionCommand.execute(): "
+                         "matches=%s",
+                         repr(matches))
 
             # Check if we have found some results
             if len(matches) == 0:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list