From 8a315f530eb5ec96342f16cc6680dc50c596a4ff Mon Sep 17 00:00:00 2001 From: Ivan-Computas Date: Mon, 2 Sep 2024 20:30:09 +0200 Subject: [PATCH 1/2] Update deploy-production-environment.yml --- .github/workflows/deploy-production-environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-production-environment.yml b/.github/workflows/deploy-production-environment.yml index 0f19b65..8e53167 100644 --- a/.github/workflows/deploy-production-environment.yml +++ b/.github/workflows/deploy-production-environment.yml @@ -46,6 +46,8 @@ jobs: environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + permissions: + id-token: write #This is required for requesting the JWT steps: - name: Download artifact from build job From c1ac5b031cf5ffbd086632f5046c5e7c58c535e9 Mon Sep 17 00:00:00 2001 From: ivaj Date: Tue, 3 Sep 2024 09:18:27 +0200 Subject: [PATCH 2/2] Add logging to multiplayer --- .gitignore | 1 + src/webapp/api.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e7c4eb3..7915390 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ config.json src/config.json .idea .venv +src/record.log diff --git a/src/webapp/api.py b/src/webapp/api.py index 7506263..600141c 100644 --- a/src/webapp/api.py +++ b/src/webapp/api.py @@ -12,6 +12,8 @@ from PIL import ImageChops from io import BytesIO from datetime import datetime +import logging +from logging.handlers import RotatingFileHandler import os import json import uuid @@ -30,9 +32,18 @@ # Initialize app app = Flask(__name__) logger = True -app.logger.setLevel("INFO") + +#config logging +logging.basicConfig(filename='record.log', level=logging.INFO, filemode="w", format="%(asctime)s %(levelname)s %(message)s") +#max file size 4 MB +handler = RotatingFileHandler( + filename='record.log', + maxBytes=4 * 1024 * 1024, + backupCount=5 +) +app.logger.addHandler(handler) + if "IS_PRODUCTION" in os.environ: - app.logger.setLevel("WARNING") logger = True if Keys.exists("CORS_ALLOWED_ORIGIN"): app.logger.info("cors is: " + Keys.get("CORS_ALLOWED_ORIGIN"))