aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/route_manager.py
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2018-02-18 01:59:50 +0100
committerGravatar GitHub <[email protected]>2018-02-18 01:59:50 +0100
commitdac0822840ebe6672834a41b1065b3cbf17d217e (patch)
treeb288b2772c48cc3ccd0db9a74440f8bda7b49fe6 /pysite/route_manager.py
parentGo back to using wss:// for the WS test (diff)
Simple logging. (#16)
* Simple logging. I don't know if this will show up in the docker logs like inver wanted, so it probably needs testing in prod. * log level via hasattr/getattr, basicConfig instead of custom handlers * removing the empty string log call
Diffstat (limited to 'pysite/route_manager.py')
-rw-r--r--pysite/route_manager.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pysite/route_manager.py b/pysite/route_manager.py
index b3f71643..6c55d0f3 100644
--- a/pysite/route_manager.py
+++ b/pysite/route_manager.py
@@ -1,6 +1,7 @@
# coding=utf-8
import importlib
import inspect
+import logging
import os
from flask import Blueprint, Flask
@@ -25,6 +26,7 @@ class RouteManager:
self.sockets = Sockets(self.app)
self.db = RethinkDB()
+ self.log = logging.getLogger()
self.app.secret_key = os.environ.get("WEBPAGE_SECRET_KEY", "super_secret")
self.app.config["SERVER_NAME"] = os.environ.get("SERVER_NAME", "pythondiscord.com:8080")
self.app.before_request(self.db.before_request)
@@ -32,26 +34,24 @@ class RouteManager:
# Load the main blueprint
self.main_blueprint = Blueprint("main", __name__)
- print(f"Loading Blueprint: {self.main_blueprint.name}")
+ self.log.debug(f"Loading Blueprint: {self.main_blueprint.name}")
self.load_views(self.main_blueprint, "pysite/views/main")
self.app.register_blueprint(self.main_blueprint)
- print("")
+ self.log.debug("")
# Load the subdomains
self.subdomains = ['api', 'staff']
for sub in self.subdomains:
sub_blueprint = Blueprint(sub, __name__, subdomain=sub)
-
- print(f"Loading Blueprint: {sub_blueprint.name}")
+ self.log.debug(f"Loading Blueprint: {sub_blueprint.name}")
self.load_views(sub_blueprint, f"pysite/views/{sub}")
self.app.register_blueprint(sub_blueprint)
- print("")
# Load the websockets
self.ws_blueprint = Blueprint("ws", __name__)
- print("Loading websocket routes...")
+ self.log.debug("Loading websocket routes...")
self.load_views(self.ws_blueprint, "pysite/views/ws")
self.sockets.register_blueprint(self.ws_blueprint, url_prefix="/ws")
@@ -89,4 +89,4 @@ class RouteManager:
)
):
cls.setup(self, blueprint)
- print(f">> View loaded: {cls.name: <15} ({module.__name__}.{cls_name})")
+ self.log.debug(f">> View loaded: {cls.name: <15} ({module.__name__}.{cls_name})")