import logging from quart import Quart from applications.config import aliyun_log_config from applications.database import mysql_manager from applications.service import LogService from routes import server_routes log_service = LogService(**aliyun_log_config) app = Quart(__name__) routes = server_routes(mysql_manager, log_service) app.register_blueprint(routes) logging.basicConfig(level=logging.INFO) @app.before_serving async def startup(): logging.info("Starting application...") await mysql_manager.init_pools() logging.info("Mysql pools init successfully") await log_service.start() logging.info("aliyun log service init successfully") @app.after_serving async def shutdown(): logging.info("Shutting down application...") await mysql_manager.close_pools() logging.info("Mysql pools close successfully") await log_service.stop() logging.info("aliyun log service stop successfully")