Debug cleanups
Switch from print to logging.X() where sensible
Change-Id: Ic691c64c581f6c20b7b8a1d46d25783782dd762e
diff --git a/db/db.py b/db/db.py
index d944f0e..2c6d089 100644
--- a/db/db.py
+++ b/db/db.py
@@ -21,6 +21,7 @@
import psycopg2
import psycopg2.extras
import datetime, os, sys
+import logging
if __name__ == '__main__':
vlandpath = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
@@ -35,7 +36,8 @@
self.connection = psycopg2.connect(database=db_name, user=username)
self.cursor = self.connection.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)
except Exception as e:
- print "Failed to access database: %s" % e
+ logging.error("Failed to access database: %s" % e)
+ raise
def __del__(self):
self.cursor.close()
@@ -349,7 +351,6 @@
#
# Returns None on failure.
def get_port_by_switch_and_name(self, switch_id, name):
- print "Looking for switch_id %s and name %s" % (switch_id, name)
return self._get_element2("port_id", "port", "switch_id", int(switch_id), "name", name)
# Simple lookup: look up a port by ID, and return the current VLAN