beans-logging 3.0.1__py3-none-any.whl → 3.0.3__py3-none-any.whl

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.
@@ -1,3 +1,3 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- __version__ = "3.0.1"
3
+ __version__ = "3.0.3"
beans_logging/_base.py CHANGED
@@ -63,7 +63,7 @@ class LoggerLoader:
63
63
  self,
64
64
  config: Union[LoggerConfigPM, dict, None] = None,
65
65
  config_file_path: str = _CONFIG_FILE_PATH,
66
- load_config_file: bool = True,
66
+ auto_config_file: bool = True,
67
67
  auto_load: bool = False,
68
68
  ):
69
69
  """LoggerLoader constructor method.
@@ -73,7 +73,7 @@ class LoggerLoader:
73
73
  dict,
74
74
  None ], optional): New logger config to update loaded config. Defaults to None.
75
75
  config_file_path (str , optional): Logger config file path. Defaults to `LoggerLoader._CONFIG_FILE_PATH`.
76
- load_config_file (bool , optional): Indicates whether to load logger config file or not. Defaults to True.
76
+ auto_config_file (bool , optional): Indicates whether to load logger config file or not. Defaults to True.
77
77
  auto_load (bool , optional): Indicates whether to load logger handlers or not. Defaults to False.
78
78
  """
79
79
 
@@ -83,7 +83,7 @@ class LoggerLoader:
83
83
 
84
84
  self._load_env_vars()
85
85
 
86
- if load_config_file:
86
+ if auto_config_file:
87
87
  self._load_config_file()
88
88
 
89
89
  if config:
@@ -5,6 +5,7 @@ import time
5
5
  from uuid import uuid4
6
6
 
7
7
  from fastapi import Request, Response
8
+ from fastapi.concurrency import run_in_threadpool
8
9
  from starlette.middleware.base import BaseHTTPMiddleware
9
10
 
10
11
  from beans_logging import logger
@@ -155,7 +156,8 @@ class HttpAccessLogMiddleware(BaseHTTPMiddleware):
155
156
  _http_info["user_id"] = str(request.state.user_id)
156
157
 
157
158
  _debug_msg = self.debug_format.format(**_http_info)
158
- _logger.debug(_debug_msg)
159
+ # _logger.debug(_debug_msg)
160
+ await run_in_threadpool(_logger.debug, _debug_msg)
159
161
 
160
162
  _start_time = time.time()
161
163
  response = await call_next(request)
@@ -218,6 +220,7 @@ class HttpAccessLogMiddleware(BaseHTTPMiddleware):
218
220
  )
219
221
 
220
222
  _msg = _msg_format.format(**_http_info)
221
- _logger.bind(http_info=_http_info).log(_LEVEL, _msg)
223
+ # _logger.bind(http_info=_http_info).log(_LEVEL, _msg)
224
+ await run_in_threadpool(_logger.bind(http_info=_http_info).log, _LEVEL, _msg)
222
225
 
223
226
  return response
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: beans-logging
3
- Version: 3.0.1
3
+ Version: 3.0.3
4
4
  Summary: beans_logging is a python package for simple logger and easily managing logging modules. It is a Loguru based custom logging package for python projects.
5
5
  Home-page: https://github.com/bybatkhuu/module.python-logging
6
- Download-URL: https://github.com/bybatkhuu/module.python-logging/archive/v3.0.1.tar.gz
6
+ Download-URL: https://github.com/bybatkhuu/module.python-logging/archive/v3.0.3.tar.gz
7
7
  Author: Batkhuu Byambajav
8
8
  Author-email: batkhuu10@gmail.com
9
9
  License: MIT
@@ -1,6 +1,6 @@
1
1
  beans_logging/__init__.py,sha256=Q0qj8822VSOzaQZ8oaFcX94U-WPLPvldtNZseRjU2CY,145
2
- beans_logging/__version__.py,sha256=aiZup6ywmXCFfCWq6RA682REkUSSdtWSAryGF9DBXp0,47
3
- beans_logging/_base.py,sha256=bm2OU53A0aCZHzEUMXxBrzE4z5-MMEcS_vBjXYPTG0U,22042
2
+ beans_logging/__version__.py,sha256=3tdyFkZ_spZfrJtQ-hmYe1aympoM4RB2Ivw1WkSOrx8,47
3
+ beans_logging/_base.py,sha256=XI1h5T_4cHXy4wfduvAqOL56WgcCKeDTWrtarzgzMeA,22042
4
4
  beans_logging/_handler.py,sha256=WQjr-dGAnjsegI2LHJl_Fubxb0reSCr8A6IvR7eN8dk,1133
5
5
  beans_logging/_utils.py,sha256=E6Naas4ZhR02Z13uqmFXkGhtF_bKKBg8dW2tqWoB4GQ,2009
6
6
  beans_logging/auto.py,sha256=V0pSpgRyazamhPxeyybtpzDUT_mrxwyn9cy2jchOOQs,392
@@ -13,12 +13,12 @@ beans_logging/fastapi/__init__.py,sha256=UWjojZwnu-ALJ57rO7tM1kNbTs4NfsMbtr5eu57
13
13
  beans_logging/fastapi/_filter.py,sha256=4XycuiWvAPIxAzq1FOfyZePyaPF3IoKHmYTM19CAJQY,504
14
14
  beans_logging/fastapi/_format.py,sha256=AcTj_yJCIz72DuGGzMML98dnZrcmfljUT5I5hiGrn8c,1373
15
15
  beans_logging/fastapi/_handler.py,sha256=HcqKSVZFTlAgLMwd405ht1w_4ud6bMYR3ErhPnj9e-Q,2208
16
- beans_logging/fastapi/_middleware.py,sha256=zCwgWiiOnHVg-fpChSdtt7CIkJHrn7XtyvWq1oPj66U,9947
16
+ beans_logging/fastapi/_middleware.py,sha256=Gtju0DlAVM0uunIYexcWt4tC1rRQbzOwsJitecziWRc,10146
17
17
  tests/__init__.py,sha256=iwhKnzeBJLKxpRVjvzwiRE63_zNpIBfaKLITauVph-0,24
18
18
  tests/conftest.py,sha256=ycEL83-UMU-fcXQUZWTCNEPcBOZ38pzhoCPpXpCjIEM,319
19
19
  tests/test_beans_logging.py,sha256=T_fR7ysCgTPi826W4TQSUL6OZTcbyHg82JHQLdfCCWI,1681
20
- beans_logging-3.0.1.dist-info/LICENSE.txt,sha256=8jrXqC7FZbke39LPGo_mUFR81CkoUCP_vyefZjlQDOg,1074
21
- beans_logging-3.0.1.dist-info/METADATA,sha256=Pf9b-MnX9yeCIOi25Op_UWMZKTrvkSBbyQwfT9PtFFM,14307
22
- beans_logging-3.0.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
23
- beans_logging-3.0.1.dist-info/top_level.txt,sha256=wSVo6vZwIqyOwwsbVBQceBQ_VJKuErw8OQvDiHcp8uU,20
24
- beans_logging-3.0.1.dist-info/RECORD,,
20
+ beans_logging-3.0.3.dist-info/LICENSE.txt,sha256=8jrXqC7FZbke39LPGo_mUFR81CkoUCP_vyefZjlQDOg,1074
21
+ beans_logging-3.0.3.dist-info/METADATA,sha256=0uEGwYJe5TNGMrnJd1gimIsn5btu08xDrSXyIVzvY2g,14307
22
+ beans_logging-3.0.3.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
23
+ beans_logging-3.0.3.dist-info/top_level.txt,sha256=wSVo6vZwIqyOwwsbVBQceBQ_VJKuErw8OQvDiHcp8uU,20
24
+ beans_logging-3.0.3.dist-info/RECORD,,