update
This commit is contained in:
@@ -56,10 +56,11 @@ class LoggerClass:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
log = LoggerClass()
|
# log = LoggerClass()
|
||||||
test_logger = log.get_log(logging.DEBUG)
|
# test_logger = log.get_log(logging.DEBUG)
|
||||||
test_logger.debug('debug')
|
# test_logger.debug('debug')
|
||||||
test_logger.info('info')
|
# test_logger.info('info')
|
||||||
test_logger.warning('warning')
|
# test_logger.warning('warning')
|
||||||
test_logger.error('error')
|
# test_logger.error('error')
|
||||||
test_logger.critical('critical')
|
# test_logger.critical('critical')
|
||||||
|
pass
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from src.My_Logger.project_logger import LoggerClass
|
|||||||
|
|
||||||
class DatabaseHandler:
|
class DatabaseHandler:
|
||||||
def __init__(self, config, logger=None):
|
def __init__(self, config, logger=None):
|
||||||
if not logger or not isinstance(logger, LoggerClass):
|
if not logger or not isinstance(logger, logging.RootLogger):
|
||||||
log = LoggerClass()
|
log = LoggerClass()
|
||||||
self.logger = log.get_log(logging.DEBUG)
|
self.logger = log.get_log(logging.DEBUG)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ class MessageUploader:
|
|||||||
shutil.copy2(source_path, destination_path)
|
shutil.copy2(source_path, destination_path)
|
||||||
return file_path.replace(file_name, new_file_name)
|
return file_path.replace(file_name, new_file_name)
|
||||||
|
|
||||||
|
def logger_test(self):
|
||||||
|
self.logger.info('this is a test')
|
||||||
|
|
||||||
|
|
||||||
def upload_didi_saved_message_to_db():
|
def upload_didi_saved_message_to_db():
|
||||||
msg_list = []
|
msg_list = []
|
||||||
@@ -198,11 +201,12 @@ if __name__ == "__main__":
|
|||||||
config['database'] = "TestDB"
|
config['database'] = "TestDB"
|
||||||
tg = MessageUploader(config_path=config_path,
|
tg = MessageUploader(config_path=config_path,
|
||||||
local_logger=LoggerClass().get_log(logging.DEBUG),
|
local_logger=LoggerClass().get_log(logging.DEBUG),
|
||||||
local_load_path='E:\\SNSFiles\\ChatExport_2023-12-27',
|
local_load_path='E:\\SNSFiles\\ChatExport_2024-07-10',
|
||||||
local_file_db_path=config['file_db_path'],
|
local_file_db_path=config['file_db_path'],
|
||||||
size_limit=0.25)
|
size_limit=0.25)
|
||||||
try:
|
try:
|
||||||
tg.do_upload()
|
# tg.do_upload()
|
||||||
|
tg.logger_test()
|
||||||
finally:
|
finally:
|
||||||
tg.db_handler.close()
|
tg.db_handler.close()
|
||||||
print('done')
|
print('done')
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import os
|
|
||||||
import time
|
|
||||||
import datetime
|
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
from src.My_Logger.project_logger import LoggerClass
|
|
||||||
from src.PostgresSQL.databaseHandler import DatabaseHandler
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
print('done')
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user