snapshot of https://github.com/ActivityWatch/aw-server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Build / Test on ubuntu-latest (push) Successful in 3m6s
Lint / lint (push) Successful in 22s
Build / typecheck (ubuntu-latest, 3.9) (push) Successful in 1m49s
Lint / format (push) Successful in 42s
Build / Test on macOS-latest (push) Has been cancelled
Build / Test on windows-latest (push) Has been cancelled
CodeQL / Analyze (python) (push) Failing after 1m31s
Some checks failed
Build / Test on ubuntu-latest (push) Successful in 3m6s
Lint / lint (push) Successful in 22s
Build / typecheck (ubuntu-latest, 3.9) (push) Successful in 1m49s
Lint / format (push) Successful in 42s
Build / Test on macOS-latest (push) Has been cancelled
Build / Test on windows-latest (push) Has been cancelled
CodeQL / Analyze (python) (push) Failing after 1m31s
This commit is contained in:
25
aw_server/log.py
Normal file
25
aw_server/log.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import logging
|
||||
|
||||
from werkzeug import serving
|
||||
|
||||
|
||||
class FlaskLogHandler(serving.WSGIRequestHandler):
|
||||
def __init__(self, *args):
|
||||
self.logger = logging.getLogger("flask")
|
||||
super().__init__(*args)
|
||||
|
||||
def log(self, levelname, message, *args):
|
||||
msg = args[0]
|
||||
code = int(args[1])
|
||||
|
||||
if code in [200, 304]:
|
||||
levelname = "debug"
|
||||
# type = "debug"
|
||||
|
||||
if levelname == "info":
|
||||
levelno = logging.INFO
|
||||
elif levelname == "debug":
|
||||
levelno = logging.DEBUG
|
||||
else:
|
||||
raise Exception("Unknown level " + type)
|
||||
self.logger.log(levelno, f"{code} ({self.address_string()}): {msg}")
|
||||
Reference in New Issue
Block a user