Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 25, 2024
1 parent 42d25e1 commit 56a6112
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
1 change: 1 addition & 0 deletions acceptance_tests/gunicorn_app/c2cwsgiutils_app/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import prometheus_client
import requests
import sqlalchemy.sql.expression
from pyramid.httpexceptions import (
HTTPBadRequest,
HTTPForbidden,
Expand Down
1 change: 1 addition & 0 deletions acceptance_tests/waitress_app/c2cwsgiutils_app/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import prometheus_client
import requests
import sqlalchemy.sql.expression
from pyramid.httpexceptions import (
HTTPBadRequest,
HTTPForbidden,
Expand Down
20 changes: 3 additions & 17 deletions c2cwsgiutils/loader.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import logging
import tempfile
from logging.config import fileConfig
import logging.config
from typing import Optional, cast

from plaster_pastedeploy import Loader as BaseLoader

from c2cwsgiutils import get_config_defaults
from c2cwsgiutils import get_config_defaults, get_logconfig_dict

_LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -36,18 +34,6 @@ def setup_logging(self, defaults: Optional[dict[str, str]] = None) -> None:
"""
if "loggers" in self.get_sections():
parser = self._get_parser(defaults)

handlers = [k.strip() for k in parser["handlers"]["keys"].split(",")]
for hh in handlers:
block = parser[f"handler_{hh}"]
if "kwargs" in block:
block["kwargs"] = block["kwargs"].replace("'ext://sys.stdout'", "sys.stdout")

defaults = self._get_defaults(defaults)
with tempfile.NamedTemporaryFile("w+t", encoding="utf-8") as temp_file:
parser.write(temp_file)
temp_file.flush()
fileConfig(temp_file.name, defaults, disable_existing_loggers=False)
logging.config.dictConfig(get_logconfig_dict(self.filename))
else:
logging.basicConfig()

0 comments on commit 56a6112

Please sign in to comment.