From 9a7d5bc68964cc4d20b6a5596812f9bcce3a6a82 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 11 Jan 2024 21:01:51 -0500 Subject: [PATCH] fix logging --- core/allnet.py | 14 +++++++++----- core/app.py | 2 -- core/frontend.py | 2 +- dbutils.py | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/allnet.py b/core/allnet.py index 8b47dca..32da0c8 100644 --- a/core/allnet.py +++ b/core/allnet.py @@ -123,9 +123,8 @@ class AllnetServlet: ) self.logger.initialized = True - self.logger.info( - f"Ready on port {self.config.allnet.port if self.config.allnet.standalone else self.config.server.port}" - ) + def startup(self) -> None: + self.logger.info(f"Ready on port {self.config.allnet.port if self.config.allnet.standalone else self.config.server.port}") async def handle_poweron(self, request: Request): request_ip = Utils.get_ip_addr(request) @@ -471,6 +470,9 @@ class BillingServlet: ) self.logger.initialized = True + def startup(self) -> None: + self.logger.info(f"Ready on port {self.config.billing.port if self.config.billing.standalone else self.config.server.port}") + def billing_req_to_dict(self, data: bytes): """ Parses an billing request string into a python dictionary @@ -894,7 +896,8 @@ app_billing = Starlette( [ Route("/request", billing.handle_billing_request, methods=["POST"]), Route("/request/", billing.handle_billing_request, methods=["POST"]), - ] + ], + on_startup=[billing.startup] ) allnet = AllnetServlet(cfg, cfg_dir) @@ -914,5 +917,6 @@ if cfg.allnet.allow_online_updates: app_allnet = Starlette( cfg.server.is_develop, - route_lst + route_lst, + on_startup=[allnet.startup] ) diff --git a/core/app.py b/core/app.py index 080e92e..e4d3330 100644 --- a/core/app.py +++ b/core/app.py @@ -54,8 +54,6 @@ title = TitleServlet(cfg, cfg_dir) # This has to be loaded first to load plugins mucha = MuchaServlet(cfg, cfg_dir) route_lst: List[Route] = [ - # Allnet - # Mucha Route("/mucha_front/boardauth.do", mucha.handle_boardauth, methods=["POST"]), Route("/mucha_front/updatacheck.do", mucha.handle_updatecheck, methods=["POST"]), diff --git a/core/frontend.py b/core/frontend.py index cbf2fe0..7b59fe3 100644 --- a/core/frontend.py +++ b/core/frontend.py @@ -144,7 +144,7 @@ class FrontendServlet(): Route("/robots.txt", self.robots) ] - def startup(self) -> None: + def startup(self) -> None: self.config.update({ "frontend": { "standalone": True, diff --git a/dbutils.py b/dbutils.py index d5af6c6..5b9b9e7 100644 --- a/dbutils.py +++ b/dbutils.py @@ -22,7 +22,7 @@ if __name__ == "__main__": parser.add_argument("--email", "-e", type=str, help="Email for the new user") parser.add_argument("--access_code", "-a", type=str, help="Access code for new/transfer user", default="00000000000000000000") parser.add_argument("--message", "-m", type=str, help="Revision message") - parser.add_argument("action", type=str, help="create, upgrade, create-owner") + parser.add_argument("action", type=str, help="create, upgrade, create-owner, migrate, create-revision") args = parser.parse_args() cfg = CoreConfig()