Quellcode durchsuchen

Add calefaction.enable_logging() function.

master
Ben Kurtovic vor 8 Jahren
Ursprung
Commit
1d511fe4d4
3 geänderte Dateien mit 16 neuen und 3 gelöschten Zeilen
  1. +2
    -0
      app.py
  2. +12
    -0
      calefaction/__init__.py
  3. +2
    -3
      calefaction/auth.py

+ 2
- 0
app.py Datei anzeigen

@@ -23,6 +23,7 @@ config = Config(basepath / "config")
Database.path = str(basepath / "data" / "db.sqlite3")
eve = EVE(config)
auth = AuthManager(config, eve)

catch_exceptions = make_error_catcher(app, "error.mako")
route_restricted = make_route_restricter(
auth, lambda: redirect(url_for("index"), 303))
@@ -30,6 +31,7 @@ route_restricted = make_route_restricter(
MakoTemplates(app)
set_up_asset_versioning(app)
config.install(app)
calefaction.enable_logging()

@app.before_request
def prepare_request():


+ 12
- 0
calefaction/__init__.py Datei anzeigen

@@ -5,3 +5,15 @@ __release__ = "0.1"

baseLogger = logging.getLogger("calefaction")
del logging

def enable_logging():
import logging

fmt = "%(asctime)s [%(levelname)s] %(name)s: %(message)s"
datefmt = "%Y-%m-%d %H:%M:%S"

formatter = logging.Formatter(fmt=fmt, datefmt=datefmt)
handler = logging.StreamHandler()
handler.setFormatter(formatter)
baseLogger.addHandler(handler)
baseLogger.setLevel(logging.DEBUG)

+ 2
- 3
calefaction/auth.py Datei anzeigen

@@ -204,13 +204,12 @@ class AuthManager:

EVEAPIError or AccessDeniedError may be raised.
"""
if "id" in session:
self._debug("Checking auth for session id=%d", session["id"])

cid = self.get_character_id()
if not cid:
return False

self._debug("Checking auth for session id=%d", session["id"])

token = self._get_token(cid)
if not token:
self._debug("No valid token for char id=%d session id=%d", cid,


Laden…
Abbrechen
Speichern