Change db init log to info
This commit is contained in:
@@ -15,9 +15,9 @@ let persistentDatabaseConnection = null;
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function initDatabaseScript() {
|
function initDatabaseScript() {
|
||||||
logToConsole(LOG_DEBUG, "[Asshat.Database]: Initializing database script ...");
|
logToConsole(LOG_INFO, "[Asshat.Database]: Initializing database script ...");
|
||||||
databaseConfig = loadDatabaseConfiguration();
|
databaseConfig = loadDatabaseConfiguration();
|
||||||
logToConsole(LOG_DEBUG, "[Asshat.Database]: Database script initialized successfully!");
|
logToConsole(LOG_INFO, "[Asshat.Database]: Database script initialized successfully!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -35,7 +35,7 @@ function connectToDatabase() {
|
|||||||
logToConsole(LOG_DEBUG, "[Asshat.Database] Database connection successful!");
|
logToConsole(LOG_DEBUG, "[Asshat.Database] Database connection successful!");
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
} else {
|
} else {
|
||||||
//logToConsole(LOG_DEBUG, "[Asshat.Database] Using existing database connection.");
|
logToConsole(LOG_DEBUG, "[Asshat.Database] Using existing database connection.");
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,12 @@ function connectToDatabase() {
|
|||||||
|
|
||||||
function disconnectFromDatabase(dbConnection) {
|
function disconnectFromDatabase(dbConnection) {
|
||||||
if(!databaseConfig.usePersistentConnection) {
|
if(!databaseConfig.usePersistentConnection) {
|
||||||
|
try {
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
|
logToConsole(LOG_DEBUG, `Database connection closed successfully`);
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Database connection could not be closed! (Error: ${error})`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -107,13 +112,20 @@ function quickDatabaseQuery(queryString) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let insertId = 0;
|
let insertId = 0;
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
|
logToConsole(LOG_DEBUG, queryString);
|
||||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||||
if(getDatabaseInsertId(dbConnection)) {
|
if(getDatabaseInsertId(dbConnection)) {
|
||||||
insertId = getDatabaseInsertId(dbConnection);
|
insertId = getDatabaseInsertId(dbConnection);
|
||||||
|
logToConsole(LOG_DEBUG, `Query returned insert id ${insertId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
|
try {
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
|
logToConsole(LOG_DEBUG, `Query result free'd successfully`);
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Query result could not be free'd! (Error: ${error})`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
|
|||||||
Reference in New Issue
Block a user