]> git.mxchange.org Git - fba.git/commitdiff
Added logging level
authorRoland <roland@mxchange.org>
Sat, 13 May 2023 23:05:18 +0000 (01:05 +0200)
committerRoland <roland@mxchange.org>
Sat, 13 May 2023 23:05:18 +0000 (01:05 +0200)
README.md
api.py
config.defaults.json

index e8bf10032b7929bd6c266d139f061067c4e9abd4..eb278ba368e28d2fd716bbaf7b8849833baddb1d 100644 (file)
--- 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 03e3314eafbe4b09eadba6fcb94ea75cfb53dca7..8e95e58d7e6e3c58964993d175e47ab61235a734 100644 (file)
--- 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)
index 06a32301ea0617461b63d2f7a01014e1d5880edf..47dfaef1430598252d2807441ca44e36dd14a725 100644 (file)
@@ -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,