From: Roland Date: Sat, 13 May 2023 23:05:18 +0000 (+0200) Subject: Added logging level X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b32b660307dd5dc644c0617b88cd4364749f5083;p=fba.git Added logging level --- diff --git a/README.md b/README.md index e8bf100..eb278ba 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,18 @@ sudo -Hu fba python3 fetch_instances.py mastodon.social # try a bunch of large s sudo -Hu fba cp config.defaults.json config.json ``` +### Alter configuration file +You maybe wish to change the configuration file, e.g. log_level is set to "info" which is the +default but invates privacy of your users, but your choice: + +``` + "critical" + "error" + "warning" + "info" + "debug" + "trace" +``` ### Install the services diff --git a/api.py b/api.py index 03e3314..8e95e58 100644 --- a/api.py +++ b/api.py @@ -13,6 +13,7 @@ with open("config.json") as f: config = loads(f.read()) base_url = config["base_url"] port = config["port"] + log_level = config["log_level"] app = FastAPI(docs_url=base_url+"/docs", redoc_url=base_url+"/redoc") templates = Jinja2Templates(directory=".") @@ -183,4 +184,4 @@ def rss(request: Request, domain: str = None): return templates.TemplateResponse("rss.xml", {"request": request, "timestamp": timestamp, "domain": domain, "blocks": result}, headers={"Content-Type": "application/rss+xml"}) if __name__ == "__main__": - uvicorn.run("api:app", host="127.0.0.1", port=port, log_level="info") + uvicorn.run("api:app", host="127.0.0.1", port=port, log_level=log_level) diff --git a/config.defaults.json b/config.defaults.json index 06a3230..47dfaef 100644 --- a/config.defaults.json +++ b/config.defaults.json @@ -1,5 +1,6 @@ { "base_url": "", + "log_level": "info", "port": 8069, "useragent": "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0", "bot_enabled": false,