diff options
author | emkael <emkael@tlen.pl> | 2018-02-24 00:54:16 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-02-24 00:54:16 +0100 |
commit | 6971fa553b1232b8faa61cb9545ac0ead78782f6 (patch) | |
tree | b97ff0eaa680af9b2c14eabf37db3824f7c31742 /jfr_playoff/db.py | |
parent | b6685df922615ebb1b36fe7a9b0e8af3261ff1dc (diff) |
Lots of lots of messages are being logged
Diffstat (limited to 'jfr_playoff/db.py')
-rw-r--r-- | jfr_playoff/db.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jfr_playoff/db.py b/jfr_playoff/db.py index b7c3726..9d26a67 100644 --- a/jfr_playoff/db.py +++ b/jfr_playoff/db.py @@ -1,9 +1,12 @@ import sys +from jfr_playoff.logger import PlayoffLogger + + class PlayoffDB(object): db_cursor = None - DATABASE_NOT_CONFIGURED_WARNING = 'WARNING: database not configured' + DATABASE_NOT_CONFIGURED_WARNING = 'database not configured' def __init__(self, settings): reload(sys) @@ -14,12 +17,14 @@ class PlayoffDB(object): password=settings['pass'], host=settings['host'], port=settings['port']) + PlayoffLogger.get('db').info('db settings: %s', settings) self.db_cursor = self.database.cursor(buffered=True) def get_cursor(self): return self.db_cursor def __execute_query(self, db_name, sql, params): + PlayoffLogger.get('db').info('query (%s): %s %s', db_name, sql.replace('\n', ' '), params) self.db_cursor.execute(sql.replace('#db#', db_name), params) def fetch(self, db_name, sql, params): @@ -29,6 +34,7 @@ class PlayoffDB(object): row = self.db_cursor.fetchone() return row except mysql.connector.Error as e: + PlayoffLogger.get('db').error(str(e)) raise IOError( message=str(e), filename=db_name, errno=e.errno, strerror=str(e)) @@ -40,6 +46,7 @@ class PlayoffDB(object): results = self.db_cursor.fetchall() return results except mysql.connector.Error as e: + PlayoffLogger.get('db').error(str(e)) raise IOError( message=str(e), filename=db_name, errno=e.errno, strerror=str(e)) |