Replace use of print with Python's logging infrastructure.
[feedingit] / src / FeedingIt.py
index a808c26..3fcf18a 100644 (file)
@@ -47,6 +47,8 @@ from config import Config
 from cgi import escape
 import weakref
 import debugging
+import logging
+logger = logging.getLogger(__name__)
 
 from rss_sqlite import Listing
 from opml import GetOpmlData, ExportOpmlData
@@ -1041,8 +1043,8 @@ class FeedingIt:
         try:
             self.orientation = FremantleRotation(__appname__, main_window=self.window, app=self)
             self.orientation.set_mode(self.config.getOrientation())
-        except:
-            print "Could not start rotation manager"
+        except Exception, e:
+            logger.warn("Could not start rotation manager: %s" % str(e))
         
         menu = hildon.AppMenu()
         # Create a button and add it to the menu
@@ -1132,7 +1134,8 @@ class FeedingIt:
             self.updateDbusHandler.ArticleCountUpdated()
 
         if not self.had_interaction and 'DBUS_STARTER_ADDRESS' in environ:
-            print "Update complete. No interaction, started by dbus: quitting."
+            logger.info(
+                "Update complete. No interaction, started by dbus: quitting.")
             self.quit()
     def stop_running_update(self, button):
         self.stopButton.set_sensitive(False)
@@ -1498,7 +1501,7 @@ if __name__ == "__main__":
         try:
             mkdir(CONFIGDIR)
         except:
-            print "Error: Can't create configuration directory"
+            logger.error("Error: Can't create configuration directory")
             from sys import exit
             exit(1)
     app = FeedingIt()