internal 1.0.108__tar.gz → 1.0.110__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.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

Files changed (38) hide show
  1. {internal-1.0.108 → internal-1.0.110}/PKG-INFO +1 -1
  2. {internal-1.0.108 → internal-1.0.110}/pyproject.toml +1 -1
  3. {internal-1.0.108 → internal-1.0.110}/src/internal/base_factory.py +3 -4
  4. internal-1.0.108/src/internal/log_config.py +0 -32
  5. {internal-1.0.108 → internal-1.0.110}/README.md +0 -0
  6. {internal-1.0.108 → internal-1.0.110}/src/internal/__init__.py +0 -0
  7. {internal-1.0.108 → internal-1.0.110}/src/internal/base_config.py +0 -0
  8. {internal-1.0.108 → internal-1.0.110}/src/internal/cache_redis.py +0 -0
  9. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/__init__.py +0 -0
  10. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/contact_type.py +0 -0
  11. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/description_type.py +0 -0
  12. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/device_code.py +0 -0
  13. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/event_code.py +0 -0
  14. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/lpr_direction.py +0 -0
  15. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/operator_type.py +0 -0
  16. {internal-1.0.108 → internal-1.0.110}/src/internal/common_enum/order_type.py +0 -0
  17. {internal-1.0.108 → internal-1.0.110}/src/internal/const.py +0 -0
  18. {internal-1.0.108 → internal-1.0.110}/src/internal/database.py +0 -0
  19. {internal-1.0.108 → internal-1.0.110}/src/internal/exception/__init__.py +0 -0
  20. {internal-1.0.108 → internal-1.0.110}/src/internal/exception/app_exception.py +0 -0
  21. {internal-1.0.108 → internal-1.0.110}/src/internal/exception/base_exception.py +0 -0
  22. {internal-1.0.108 → internal-1.0.110}/src/internal/exception/internal_exception.py +0 -0
  23. {internal-1.0.108 → internal-1.0.110}/src/internal/ext/__init__.py +0 -0
  24. {internal-1.0.108 → internal-1.0.110}/src/internal/ext/amazon/__init__.py +0 -0
  25. {internal-1.0.108 → internal-1.0.110}/src/internal/ext/amazon/aws/__init__.py +0 -0
  26. {internal-1.0.108 → internal-1.0.110}/src/internal/ext/amazon/aws/const.py +0 -0
  27. {internal-1.0.108 → internal-1.0.110}/src/internal/http/__init__.py +0 -0
  28. {internal-1.0.108 → internal-1.0.110}/src/internal/http/requests.py +0 -0
  29. {internal-1.0.108 → internal-1.0.110}/src/internal/http/responses.py +0 -0
  30. {internal-1.0.108 → internal-1.0.110}/src/internal/interface/__init__.py +0 -0
  31. {internal-1.0.108 → internal-1.0.110}/src/internal/interface/base_interface.py +0 -0
  32. {internal-1.0.108 → internal-1.0.110}/src/internal/middleware/__init__.py +0 -0
  33. {internal-1.0.108 → internal-1.0.110}/src/internal/middleware/log_request.py +0 -0
  34. {internal-1.0.108 → internal-1.0.110}/src/internal/model/__init__.py +0 -0
  35. {internal-1.0.108 → internal-1.0.110}/src/internal/model/base_model.py +0 -0
  36. {internal-1.0.108 → internal-1.0.110}/src/internal/model/operate.py +0 -0
  37. {internal-1.0.108 → internal-1.0.110}/src/internal/utils.py +0 -0
  38. {internal-1.0.108 → internal-1.0.110}/src/internal/validator_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: internal
3
- Version: 1.0.108
3
+ Version: 1.0.110
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "internal"
3
- version = "1.0.108"
3
+ version = "1.0.110"
4
4
  description = ""
5
5
  authors = [{ name = "Ray", email = "ray@cruisys.com" }]
6
6
  readme = "README.md"
@@ -1,12 +1,11 @@
1
1
  import logging
2
- import logging.config
3
2
  import logging.handlers
4
3
  import os
5
4
  import traceback
6
5
  from abc import ABCMeta, abstractmethod
7
6
  from contextlib import asynccontextmanager
8
7
  from functools import lru_cache
9
- from asgi_correlation_id import CorrelationIdMiddleware
8
+ from asgi_correlation_id import CorrelationIdMiddleware, CorrelationIdFilter
10
9
 
11
10
  import dotenv
12
11
  import watchtower
@@ -22,7 +21,6 @@ from .exception.internal_exception import BadGatewayException, GatewayTimeoutExc
22
21
  from .ext.amazon import aws
23
22
  from .http.requests import async_request
24
23
  from .http.responses import async_response
25
- from .log_config import LOGGING
26
24
  from .middleware.log_request import LogRequestMiddleware
27
25
  from .utils import update_dict_with_cast
28
26
 
@@ -233,12 +231,12 @@ class BaseFactory(metaclass=ABCMeta):
233
231
 
234
232
  #
235
233
  def __setup_logger(self, app, logger_name, level=logging.INFO):
236
- logging.config.dictConfig(LOGGING)
237
234
  logger = logging.getLogger(logger_name)
238
235
  logger.setLevel(level)
239
236
 
240
237
  stream_handler = logging.StreamHandler()
241
238
  stream_handler.setFormatter(logging.Formatter(fmt=LOG_FMT))
239
+ stream_handler.addFilter(CorrelationIdFilter())
242
240
  logger.addHandler(stream_handler)
243
241
 
244
242
  return logger
@@ -250,6 +248,7 @@ class BaseFactory(metaclass=ABCMeta):
250
248
  log_group_name=self.get_app_config().AWS_LOGGROUP_NAME,
251
249
  boto3_client=logs_client, create_log_group=False)
252
250
  watchtower_handler.setFormatter(logging.Formatter(fmt=LOG_FMT_NO_DT, datefmt=LOG_DT_FMT))
251
+ watchtower_handler.addFilter(CorrelationIdFilter())
253
252
  app.state.logger.addHandler(watchtower_handler)
254
253
 
255
254
  def __init_builtin_api(self, app):
@@ -1,32 +0,0 @@
1
- LOGGING = {
2
- 'version': 1,
3
- 'disable_existing_loggers': False,
4
- 'filters': {
5
- 'correlation_id': {
6
- '()': 'asgi_correlation_id.CorrelationIdFilter',
7
- 'uuid_length': 32,
8
- 'default_value': '-',
9
- },
10
- },
11
- 'formatters': {
12
- 'web': {
13
- 'class': 'logging.Formatter',
14
- 'datefmt': '%H:%M:%S',
15
- 'format': '%(levelname)s ... [%(correlation_id)s] %(name)s %(message)s',
16
- },
17
- },
18
- 'handlers': {
19
- 'web': {
20
- 'class': 'logging.StreamHandler',
21
- 'filters': ['correlation_id'],
22
- 'formatter': 'web',
23
- },
24
- },
25
- 'loggers': {
26
- 'my_project': {
27
- 'handlers': ['web'],
28
- 'level': 'DEBUG',
29
- 'propagate': True,
30
- },
31
- },
32
- }
File without changes