summaryrefslogtreecommitdiff
path: root/src/jfrteamy/db.py
diff options
context:
space:
mode:
authorMichał Klichowicz <emkael@tlen.pl>2023-09-30 13:14:45 +0200
committerMichał Klichowicz <emkael@tlen.pl>2023-09-30 13:14:45 +0200
commitcfe576d81fa2b6be345bb60d4724d60f8880b5b4 (patch)
tree2dc829c048a3dca2c4e4f5d2b28d5e63ff0031c4 /src/jfrteamy/db.py
parent14a168065571448c19047cdedf262642cf9f8371 (diff)
* passed-out hands
* proper logging * fetching remote PBN file
Diffstat (limited to 'src/jfrteamy/db.py')
-rw-r--r--src/jfrteamy/db.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jfrteamy/db.py b/src/jfrteamy/db.py
index b66f8d0..9302fe3 100644
--- a/src/jfrteamy/db.py
+++ b/src/jfrteamy/db.py
@@ -1,4 +1,4 @@
-import sys
+import logging, sys
class TeamyDB(object):
@@ -22,7 +22,7 @@ class TeamyDB(object):
return self.db_cursor
def __execute_query(self, sql, params):
- #print('DEBUG: query (%s): %s | %s' % (self.db_name, sql.replace('\n', ' '), params))
+ logging.debug('query (%s): %s | %s' % (self.db_name, sql.replace('\n', ' '), params))
self.db_cursor.execute(sql, params)
def fetch(self, sql, params=None):
@@ -32,7 +32,7 @@ class TeamyDB(object):
row = self.db_cursor.fetchone()
return row
except mysql.connector.Error as e:
- print('ERROR: ' + str(e))
+ logging.error(str(e))
raise IOError(e.errno, str(e), sql)
def fetch_all(self, sql, params=None):
@@ -42,6 +42,6 @@ class TeamyDB(object):
results = self.db_cursor.fetchall()
return results
except mysql.connector.Error as e:
- print('ERROR: ' + str(e))
+ logging.error(str(e))
raise IOError(
e.errno, str(e), sql)