saas1.6日志更新
This commit is contained in:
@@ -34,24 +34,6 @@ class Config:
|
||||
RETRY_DELAY = 0.5
|
||||
|
||||
|
||||
# ---------------------- 日志配置 -----------------------
|
||||
# class Logger:
|
||||
# @staticmethod
|
||||
# def setup():
|
||||
# logging.basicConfig(
|
||||
# level=logging.INFO,
|
||||
# format='%(asctime)s - %(levelname)s - %(message)s',
|
||||
# handlers=[
|
||||
# logging.StreamHandler(),
|
||||
# logging.FileHandler(Config.LOG_FILE)
|
||||
# ]
|
||||
# )
|
||||
# return logging.getLogger(__name__)
|
||||
#
|
||||
#
|
||||
# logger = Logger.setup()
|
||||
|
||||
|
||||
# ---------------------- 工具函数 -----------------------
|
||||
class Utils:
|
||||
@staticmethod
|
||||
@@ -379,18 +361,23 @@ class DataMonitor(DataHandler):
|
||||
|
||||
def main(self):
|
||||
import datetime
|
||||
task_start_time =datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
logger.info(f"=== 开始数据监控任务 ({self.execution_time}) ===")
|
||||
task_start_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
try:
|
||||
logger.info(f"=== 开始数据监控任务 ({self.execution_time}) ===")
|
||||
|
||||
if Utils.is_first_run_today():
|
||||
success = self.run_daily_snapshot()
|
||||
else:
|
||||
success = self.run_hourly_check()
|
||||
if Utils.is_first_run_today():
|
||||
success = self.run_daily_snapshot()
|
||||
else:
|
||||
success = self.run_hourly_check()
|
||||
|
||||
common_tools.send_task_status(task_start_time, "字段监控")
|
||||
common_tools.send_task_status(task_start_time, "字段监控")
|
||||
|
||||
logger.info("=== 数据监控任务完成 ===")
|
||||
return success
|
||||
logger.info("=== 数据监控任务完成 ===")
|
||||
return success
|
||||
except Exception as e:
|
||||
error_task_logger.error(f"数据监控任务发生异常: {e}")
|
||||
common_tools.send_task_error(task_start_time, "字段监控", str(e))
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user