Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b687e0ef8 | ||
|
|
67209fa091 |
No files matched your search
@@ -13,6 +13,7 @@
|
||||
## Import Libaries & Local Modules
|
||||
import logging
|
||||
from modules.class_import_dotenv import ImportDotenv
|
||||
import modules.class_database as log_db
|
||||
|
||||
## Run Script
|
||||
if __name__ == "__main__":
|
||||
@@ -28,6 +29,7 @@ if __name__ == "__main__":
|
||||
logging.basicConfig(filename=variables['LOG_FILE'], level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
|
||||
# Create Database (SQLite DB)
|
||||
log_db()
|
||||
|
||||
# Check SSH Connection
|
||||
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
import sqlite3
|
||||
import logging
|
||||
import os
|
||||
|
||||
class LogDatabase():
|
||||
|
||||
def __init__(self,database_host,database_username, database_password, database_name):
|
||||
def __init__(self,database_host,database_username, database_password, database_name, log_mode):
|
||||
|
||||
self.database_host = database_host
|
||||
self.database_username = database_username
|
||||
self.database_password = database_password
|
||||
self.database_name = database_name
|
||||
self.log_mode = log_mode
|
||||
|
||||
|
||||
try:
|
||||
if os.path.exists(self.database_name):
|
||||
sqlite3.connect(self.database_name)
|
||||
except Exception as e:
|
||||
if self.log_mode == "1":
|
||||
logging.error(f"Database Error: \n\n {str(e)}")
|
||||
elif self.log_mode == "2":
|
||||
print(f"Database Error: \n\n {str(e)}")
|
||||
|
||||
def db_creation(self):
|
||||
pass
|
||||
|
||||
def db_inserts(self, data):
|
||||
pass
|
||||
Reference in new issue
Block a user