mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix debug mode in gaiohttp worker
The debug setting has been removed and now only the debug level can be used to know if we are in debug mode or not. This change update the gaiohttp worker to handle that. While I'm here, expose the loglevel from the Logger class. fix #977
This commit is contained in:
parent
d8eca3ebf1
commit
8b6d86ef2b
@ -171,12 +171,13 @@ class Logger(object):
|
||||
self.access_log.propagate = False
|
||||
self.error_handlers = []
|
||||
self.access_handlers = []
|
||||
self.loglevel = logging.INFO
|
||||
self.cfg = cfg
|
||||
self.setup(cfg)
|
||||
|
||||
def setup(self, cfg):
|
||||
loglevel = self.LOG_LEVELS.get(cfg.loglevel.lower(), logging.INFO)
|
||||
self.error_log.setLevel(loglevel)
|
||||
self.loglevel = self.LOG_LEVELS.get(cfg.loglevel.lower(), logging.INFO)
|
||||
self.error_log.setLevel(self.loglevel)
|
||||
self.access_log.setLevel(logging.INFO)
|
||||
|
||||
# set gunicorn.error handler
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
import asyncio
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
import gunicorn.workers.base as base
|
||||
|
||||
@ -44,11 +45,14 @@ class AiohttpWorker(base.Worker):
|
||||
return proto
|
||||
|
||||
def factory(self, wsgi, addr):
|
||||
# are we in debug level
|
||||
is_debug = self.log.loglevel == logging.DEBUG
|
||||
|
||||
proto = WSGIServerHttpProtocol(
|
||||
wsgi, readpayload=True,
|
||||
loop=self.loop,
|
||||
log=self.log,
|
||||
debug=self.cfg.debug,
|
||||
debug=is_debug,
|
||||
keep_alive=self.cfg.keepalive,
|
||||
access_log=self.log.access_log,
|
||||
access_log_format=self.cfg.access_log_format)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user