c2cwsgiutils 6.2.0.dev374__tar.gz → 6.2.0.dev376__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/PKG-INFO +1 -1
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/README.md +30 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/handlers.py +24 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/pyproject.toml +2 -2
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/LICENSE +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/connection.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/image.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/package-lock.json +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/package.json +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/print.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/screenshot.js +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/auth.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/broadcast/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/broadcast/interface.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/broadcast/local.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/broadcast/redis.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/broadcast/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/client_info.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/config_utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/coverage_setup.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/db.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/db_maintenance_view.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/debug/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/debug/_listeners.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/debug/_views.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/debug/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/errors.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/health_check.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/index.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/loader.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/logging_view.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/models_graph.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/pretty_json.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/profiler.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/prometheus.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/py.typed +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/pyramid.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/pyramid_logging.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/redis_stats.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/redis_utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/request_tracking/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/request_tracking/_sql.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/scripts/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/scripts/genversion.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/scripts/stats_db.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/scripts/test_print.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sentry.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/services.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/setup_process.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sql_profiler/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sql_profiler/_impl.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/_filters.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/_models.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/examples/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/examples/example.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/static/favicon-16x16.png +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/static/favicon-32x32.png +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/stats_pyramid/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/stats_pyramid/_db_spy.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/templates/index.html.mako +0 -0
- {c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/version.py +0 -0
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/README.md
RENAMED
|
@@ -63,3 +63,33 @@ if __name__ == '__main__':
|
|
|
63
63
|
# logs after a timeout
|
|
64
64
|
time.sleep(2)
|
|
65
65
|
```
|
|
66
|
+
|
|
67
|
+
## Use with forking server (ex: `gunicorn`)
|
|
68
|
+
|
|
69
|
+
Snippet for configuration with `gunicorn` and `paste`:
|
|
70
|
+
|
|
71
|
+
`production.ini`:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
[handler_sqlalchemylogger]
|
|
75
|
+
class = c2cwsgiutils.sqlalchemylogger.handlers.SQLAlchemyHandler
|
|
76
|
+
args = ({'url':'postgresql://','tablename':'logs','tableargs': {'schema':'logs'}, 'delay_startup': True},'healthcheck')
|
|
77
|
+
level = NOTSET
|
|
78
|
+
formatter = generic
|
|
79
|
+
propagate = 0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`gunicorn.conf.py`:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
def post_fork(server, worker):
|
|
86
|
+
import logging
|
|
87
|
+
logger = logging.getHandlerByName('sqlalchemylogger')
|
|
88
|
+
logger.start()
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The gunicorn must be started with this config file:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
gunicorn -c gunicorn.conf.py [...]
|
|
95
|
+
```
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/handlers.py
RENAMED
|
@@ -36,6 +36,29 @@ class SQLAlchemyHandler(logging.Handler):
|
|
|
36
36
|
) -> None:
|
|
37
37
|
"""Initialize the SQLAlchemyHandler."""
|
|
38
38
|
super().__init__()
|
|
39
|
+
|
|
40
|
+
self.started = False
|
|
41
|
+
if sqlalchemy_url.get("delay_startup", False):
|
|
42
|
+
self.sqlalchemy_url = sqlalchemy_url
|
|
43
|
+
self.does_not_contain_expression = does_not_contain_expression
|
|
44
|
+
self.contains_expression = contains_expression
|
|
45
|
+
else:
|
|
46
|
+
self._start(sqlalchemy_url, does_not_contain_expression, contains_expression)
|
|
47
|
+
|
|
48
|
+
def start(self) -> None:
|
|
49
|
+
"""Force startup of logger in case of delayed startup."""
|
|
50
|
+
self._start(self.sqlalchemy_url, self.does_not_contain_expression, self.contains_expression)
|
|
51
|
+
|
|
52
|
+
def _start(
|
|
53
|
+
self,
|
|
54
|
+
sqlalchemy_url: dict[str, str],
|
|
55
|
+
does_not_contain_expression: str,
|
|
56
|
+
contains_expression: str,
|
|
57
|
+
) -> None:
|
|
58
|
+
if self.started:
|
|
59
|
+
# only start once
|
|
60
|
+
return
|
|
61
|
+
|
|
39
62
|
# Initialize DB session
|
|
40
63
|
self.engine = create_engine(sqlalchemy_url["url"])
|
|
41
64
|
self.Log = create_log_class( # pylint: disable=invalid-name
|
|
@@ -55,6 +78,7 @@ class SQLAlchemyHandler(logging.Handler):
|
|
|
55
78
|
self.addFilter(DoesNotContainExpression(does_not_contain_expression))
|
|
56
79
|
if contains_expression:
|
|
57
80
|
self.addFilter(ContainsExpression(contains_expression))
|
|
81
|
+
self.started = True
|
|
58
82
|
|
|
59
83
|
def _processor(self) -> None:
|
|
60
84
|
_LOG.debug("%s: starting processor thread", __name__)
|
|
@@ -54,7 +54,7 @@ SQLAlchemy = { version = "2.0.52", optional = true }
|
|
|
54
54
|
SQLAlchemy-Utils = { version = "0.42.1", optional = true }
|
|
55
55
|
"zope.interface" = { version = "8.6", optional = true }
|
|
56
56
|
"zope.sqlalchemy" = { version = "4.1", optional = true }
|
|
57
|
-
pyjwt = { version = "2.
|
|
57
|
+
pyjwt = { version = "2.14.0", optional = true }
|
|
58
58
|
requests-oauthlib = { version = "2.0.0", optional = true }
|
|
59
59
|
waitress = { version = "3.0.2", optional = true }
|
|
60
60
|
scikit-image = { version = "0.26.0", optional = true }
|
|
@@ -229,7 +229,7 @@ include = [
|
|
|
229
229
|
]
|
|
230
230
|
requires-python = ">=3.11"
|
|
231
231
|
dependencies = ["requests", "pyyaml", "ujson", "cee_syslog_handler", "prometheus-client", "setuptools<81.0.0"]
|
|
232
|
-
version = "6.2.0.
|
|
232
|
+
version = "6.2.0.dev376"
|
|
233
233
|
|
|
234
234
|
[project.urls]
|
|
235
235
|
repository = "https://github.com/camptocamp/c2cwsgiutils"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/connection.py
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/package-lock.json
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/package.json
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/acceptance/screenshot.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/request_tracking/__init__.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/request_tracking/_sql.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sql_profiler/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/__init__.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/_filters.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/sqlalchemylogger/_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/static/favicon-16x16.png
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/static/favicon-32x32.png
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/stats_pyramid/__init__.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/stats_pyramid/_db_spy.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev374 → c2cwsgiutils-6.2.0.dev376}/c2cwsgiutils/templates/index.html.mako
RENAMED
|
File without changes
|
|
File without changes
|