izihawa-loglib 1.1.3__py3-none-any.whl → 1.1.5__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.
@@ -2,6 +2,7 @@ import logging
2
2
  import logging.config
3
3
  import sys
4
4
 
5
+ import confuse
5
6
  from izihawa_utils.exceptions import BaseError
6
7
  from izihawa_utils.file import mkdir_p
7
8
 
@@ -9,14 +10,14 @@ from .handlers import QueueHandler
9
10
 
10
11
 
11
12
  def configure_logging(
12
- config: dict, make_path: bool = False, default_level=logging.INFO
13
+ config: confuse.Configuration, make_path: bool = False, default_level=logging.INFO
13
14
  ):
14
- if config.get("application", {}).get("debug", False) or "logging" not in config:
15
+ if config["application"]["debug"].get(bool) or "logging" not in config:
15
16
  logging.basicConfig(stream=sys.stdout, level=default_level)
16
17
  else:
17
18
  if make_path:
18
- mkdir_p(config["log_path"])
19
- logging.config.dictConfig(config["logging"])
19
+ mkdir_p(config["log_path"].get(str))
20
+ logging.config.dictConfig(config["logging"].get(dict))
20
21
 
21
22
 
22
23
  def error_log(e, level=logging.ERROR, **fields):
@@ -26,7 +27,7 @@ def error_log(e, level=logging.ERROR, **fields):
26
27
  e.update(fields)
27
28
  elif fields:
28
29
  e = {"error": repr(e), **fields}
29
- logging.getLogger("error").log(msg=str(e), level=level)
30
+ logging.getLogger("error").log(msg=str(e), level=level, exc_info=True)
30
31
 
31
32
 
32
33
  __all__ = [
@@ -7,12 +7,10 @@ from izihawa_utils.random import generate_request_id
7
7
  class RequestContext:
8
8
  request_id_length: int = 12
9
9
 
10
- def __init__(
11
- self,
12
- request_id: str = None,
13
- **kwargs
14
- ):
15
- self.request_id = request_id or RequestContext.generate_request_id(self.request_id_length)
10
+ def __init__(self, request_id: str = None, **kwargs):
11
+ self.request_id = request_id or RequestContext.generate_request_id(
12
+ self.request_id_length
13
+ )
16
14
  self.default_fields = {
17
15
  "request_id": self.request_id,
18
16
  **kwargs,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: izihawa_loglib
3
- Version: 1.1.3
3
+ Version: 1.1.5
4
4
  Summary: Izihawa log utilities
5
5
  Author: Pasha Podolsky
6
6
  Author-email: ppodolsky@me.com
@@ -0,0 +1,7 @@
1
+ izihawa_loglib/__init__.py,sha256=WByRneiSW-mxN_xFFSJjoBXiMmpCJaHR-yyrSRlqUiM,981
2
+ izihawa_loglib/formatters.py,sha256=ZQj0FMJs4qJcaFKz__VSsrUGXgMcXhQKSTAqemWYZG8,2816
3
+ izihawa_loglib/handlers.py,sha256=UMBb7VSFvo4QUD0aueyzmh2ryq5tl8U4iKB9IIbax-0,1095
4
+ izihawa_loglib/request_context.py,sha256=HMFD149Wpv2rw23NpEIRie_Dts86S3_u_swnEYXY4Qs,1143
5
+ izihawa_loglib-1.1.5.dist-info/METADATA,sha256=3g4xxU2ZaUb6M6RxYTWiiCkc4vPMfPyyAfOMTPuU7go,656
6
+ izihawa_loglib-1.1.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
+ izihawa_loglib-1.1.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
1
- izihawa_loglib/__init__.py,sha256=djy4KesNck1p3BYic3QOs6t3dKns7VyG6Mv37itL2yw,924
2
- izihawa_loglib/formatters.py,sha256=ZQj0FMJs4qJcaFKz__VSsrUGXgMcXhQKSTAqemWYZG8,2816
3
- izihawa_loglib/handlers.py,sha256=UMBb7VSFvo4QUD0aueyzmh2ryq5tl8U4iKB9IIbax-0,1095
4
- izihawa_loglib/request_context.py,sha256=2V2RyrWn0FsNSdy7OstrGbiGNiRiuxVifdG8T02pvUE,1151
5
- izihawa_loglib-1.1.3.dist-info/METADATA,sha256=-J1ixeFXKcLGt46LJM89r-FUUNdXeLrVWVzci_fDDEE,656
6
- izihawa_loglib-1.1.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
7
- izihawa_loglib-1.1.3.dist-info/RECORD,,