miu-logger 0.1.4__tar.gz → 0.1.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: miu-logger
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Multiprocessing-safe domain-based logging framework with QueueListener architecture
5
5
  Author-email: Bruno Miura <brumiura@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "miu-logger"
3
- version = "0.1.4"
3
+ version = "0.1.6"
4
4
  description = "Multiprocessing-safe domain-based logging framework with QueueListener architecture"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -51,7 +51,7 @@ class SafeQueueListener(QueueListener):
51
51
  raise
52
52
 
53
53
 
54
- def setup_main_listener(config: LogConfig):
54
+ def setup_main_listener(config: LogConfig) -> tuple[Queue, SafeQueueListener]:
55
55
  os.makedirs(config.log_dir, exist_ok=True)
56
56
 
57
57
  queue = Queue(-1)
@@ -0,0 +1,62 @@
1
+ from pathlib import Path
2
+ from typing import Iterable
3
+
4
+
5
+ REPOSITORY_TEMPLATE = """from typing import Optional
6
+ from queue import Queue
7
+ from miu_logger.conditional import ConditionalLogger
8
+ from miu_logger.config import LogConfig
9
+
10
+
11
+ class LoggingRepository:
12
+ def __init__(
13
+ self,
14
+ config: LogConfig,
15
+ *,
16
+ use_listener: bool = True,
17
+ queue: Optional[Queue] = None
18
+ ) -> None: ...
19
+
20
+ {domains}
21
+
22
+ def get(self, domain: str) -> ConditionalLogger: ...
23
+ def get_queue(self) -> Queue: ...
24
+ def shutdown(self) -> None: ...
25
+ """
26
+
27
+ CONDITIONAL_LOGGER_STUB = """from typing import Any
28
+ import logging
29
+
30
+
31
+ class ConditionalLogger:
32
+ def __init__(self, logger: logging.Logger, should_log_debug: Any) -> None: ...
33
+
34
+ def debug(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
35
+ def info(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
36
+ def warning(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
37
+ def error(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
38
+ def critical(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
39
+ def exception(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
40
+ """
41
+
42
+
43
+ def generate_repository_stub(domains: Iterable[str], out_dir: str = "typings") -> None:
44
+ out_path = Path(out_dir) / "miu_logger"
45
+ out_path.mkdir(parents=True, exist_ok=True)
46
+
47
+ # Generate repository.pyi
48
+ lines = []
49
+ for d in domains:
50
+ lines.append(f" @property")
51
+ lines.append(f" def {d}(self) -> ConditionalLogger: ...")
52
+
53
+ content = REPOSITORY_TEMPLATE.format(domains="\n".join(lines))
54
+
55
+ with open(out_path / "repository.pyi", "w") as f:
56
+ f.write(content)
57
+
58
+ # Generate conditional.pyi
59
+ with open(out_path / "conditional.pyi", "w") as f:
60
+ f.write(CONDITIONAL_LOGGER_STUB)
61
+
62
+ print(f"✓ Generated stubs in {out_path}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: miu-logger
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Multiprocessing-safe domain-based logging framework with QueueListener architecture
5
5
  Author-email: Bruno Miura <brumiura@gmail.com>
6
6
  License-Expression: MIT
@@ -1,25 +0,0 @@
1
- from pathlib import Path
2
- from typing import Iterable
3
-
4
-
5
- TEMPLATE = """from typing import Any
6
- from miu_logger.conditional import ConditionalLogger
7
-
8
-
9
- class LoggingRepository:
10
- {domains}
11
- """
12
-
13
-
14
- def generate_repository_stub(domains: Iterable[str], out_dir: str = "typings") -> None:
15
- out_path = Path(out_dir) / "miu_logger"
16
- out_path.mkdir(parents=True, exist_ok=True)
17
-
18
- lines = []
19
- for d in domains:
20
- lines.append(f" {d}: ConditionalLogger")
21
-
22
- content = TEMPLATE.format(domains="\n".join(lines))
23
-
24
- with open(out_path / "repository.pyi", "w") as f:
25
- f.write(content)
File without changes
File without changes
File without changes