Skip to content

Commit

Permalink
Add logging to multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Computas committed Sep 3, 2024
1 parent 8a315f5 commit c1ac5b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ config.json
src/config.json
.idea
.venv
src/record.log
15 changes: 13 additions & 2 deletions src/webapp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"))
Expand Down

0 comments on commit c1ac5b0

Please sign in to comment.