Revamp the logging a bit. Not quite done yet.
This commit is contained in:
parent
3fb4fafb33
commit
a5a61576ae
10 changed files with 91 additions and 52 deletions
|
@ -1,23 +0,0 @@
|
|||
import logging
|
||||
import logstash_formatter
|
||||
import gunicorn.glogging
|
||||
|
||||
from gunicorn import util
|
||||
|
||||
class LogstashLogger(gunicorn.glogging.Logger):
|
||||
def _set_handler(self, log, output, fmt):
|
||||
# remove previous gunicorn log handler
|
||||
h = self._get_gunicorn_handler(log)
|
||||
if h:
|
||||
log.handlers.remove(h)
|
||||
|
||||
if output is not None:
|
||||
if output == "-":
|
||||
h = logging.StreamHandler()
|
||||
else:
|
||||
util.check_is_writeable(output)
|
||||
h = logging.FileHandler(output)
|
||||
|
||||
h.setFormatter(logstash_formatter.LogstashFormatter())
|
||||
h._gunicorn = True
|
||||
log.addHandler(h)
|
Reference in a new issue