This commit is contained in:
2024-07-10 16:46:28 +08:00
parent 70d3974058
commit 5c3526319f
4 changed files with 15 additions and 23 deletions
+8 -7
View File
@@ -56,10 +56,11 @@ class LoggerClass:
if __name__ == '__main__':
log = LoggerClass()
test_logger = log.get_log(logging.DEBUG)
test_logger.debug('debug')
test_logger.info('info')
test_logger.warning('warning')
test_logger.error('error')
test_logger.critical('critical')
# log = LoggerClass()
# test_logger = log.get_log(logging.DEBUG)
# test_logger.debug('debug')
# test_logger.info('info')
# test_logger.warning('warning')
# test_logger.error('error')
# test_logger.critical('critical')
pass
+1 -1
View File
@@ -5,7 +5,7 @@ from src.My_Logger.project_logger import LoggerClass
class DatabaseHandler:
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()
self.logger = log.get_log(logging.DEBUG)
else:
+6 -2
View File
@@ -164,6 +164,9 @@ class MessageUploader:
shutil.copy2(source_path, destination_path)
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():
msg_list = []
@@ -198,11 +201,12 @@ if __name__ == "__main__":
config['database'] = "TestDB"
tg = MessageUploader(config_path=config_path,
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'],
size_limit=0.25)
try:
tg.do_upload()
# tg.do_upload()
tg.logger_test()
finally:
tg.db_handler.close()
print('done')
-13
View File
@@ -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')