custom-python-logger 2.0.5__tar.gz → 2.0.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.
Files changed (20) hide show
  1. {custom_python_logger-2.0.5/custom_python_logger.egg-info → custom_python_logger-2.0.6}/PKG-INFO +1 -1
  2. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger/__init__.py +2 -0
  3. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger/logger.py +12 -12
  4. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6/custom_python_logger.egg-info}/PKG-INFO +1 -1
  5. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger.egg-info/SOURCES.txt +0 -1
  6. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/setup.py +1 -1
  7. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/tests/test_usage_example_pytest.py +1 -1
  8. custom_python_logger-2.0.5/custom_python_logger/usage_example.py +0 -42
  9. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/LICENSE +0 -0
  10. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/MANIFEST.in +0 -0
  11. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/README.md +0 -0
  12. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger/consts.py +0 -0
  13. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger.egg-info/dependency_links.txt +0 -0
  14. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger.egg-info/requires.txt +0 -0
  15. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/custom_python_logger.egg-info/top_level.txt +0 -0
  16. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/pyproject.toml +0 -0
  17. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/requirements.txt +0 -0
  18. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/setup.cfg +0 -0
  19. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/tests/test_logger.py +0 -0
  20. {custom_python_logger-2.0.5 → custom_python_logger-2.0.6}/tests/test_logger_pytest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: custom-python-logger
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: A custom logger with color support and additional features.
5
5
  Home-page: https://github.com/aviz92/custom-python-logger
6
6
  Author: Avi Zaguri
@@ -1,5 +1,6 @@
1
1
  from custom_python_logger.logger import (
2
2
  CustomLoggerAdapter,
3
+ CustomLoggerLevel,
3
4
  build_logger,
4
5
  get_logger,
5
6
  json_pretty_format,
@@ -8,6 +9,7 @@ from custom_python_logger.logger import (
8
9
 
9
10
  __all__ = [
10
11
  "CustomLoggerAdapter",
12
+ "CustomLoggerLevel",
11
13
  "build_logger",
12
14
  "get_logger",
13
15
  "json_pretty_format",
@@ -136,6 +136,17 @@ def configure_logging(
136
136
  )
137
137
 
138
138
 
139
+ def get_logger(name: str, log_level: int | None = None, extra: dict | None = None) -> CustomLoggerAdapter:
140
+ child_logger = logging.getLogger(CHILD_LOGGER)
141
+ new_logger = CustomLoggerAdapter(logging.getLogger(name), extra=extra)
142
+
143
+ if not log_level:
144
+ log_level = child_logger.level
145
+ new_logger.setLevel(log_level)
146
+
147
+ return new_logger
148
+
149
+
139
150
  def build_logger(
140
151
  project_name: str,
141
152
  extra: dict[str, Any] | None = None,
@@ -175,15 +186,4 @@ def build_logger(
175
186
  logger = CustomLoggerAdapter(logging.getLogger(CHILD_LOGGER), extra)
176
187
  logger.setLevel(log_level)
177
188
 
178
- return logger
179
-
180
-
181
- def get_logger(name: str, log_level: int | None = None, extra: dict | None = None) -> CustomLoggerAdapter:
182
- child_logger = logging.getLogger(CHILD_LOGGER)
183
- new_logger = CustomLoggerAdapter(logging.getLogger(name), extra=extra)
184
-
185
- if not log_level:
186
- log_level = child_logger.level
187
- new_logger.setLevel(log_level)
188
-
189
- return new_logger
189
+ return get_logger(project_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: custom-python-logger
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: A custom logger with color support and additional features.
5
5
  Home-page: https://github.com/aviz92/custom-python-logger
6
6
  Author: Avi Zaguri
@@ -7,7 +7,6 @@ setup.py
7
7
  custom_python_logger/__init__.py
8
8
  custom_python_logger/consts.py
9
9
  custom_python_logger/logger.py
10
- custom_python_logger/usage_example.py
11
10
  custom_python_logger.egg-info/PKG-INFO
12
11
  custom_python_logger.egg-info/SOURCES.txt
13
12
  custom_python_logger.egg-info/dependency_links.txt
@@ -1,6 +1,6 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
- package_version = "2.0.5"
3
+ package_version = "2.0.6"
4
4
 
5
5
  package_name = "custom-python-logger"
6
6
  package_description = "A custom logger with color support and additional features."
@@ -1,4 +1,4 @@
1
- from custom_python_logger.usage_example import main
1
+ from usage_example.example_1 import main
2
2
 
3
3
 
4
4
  def test_usage_example_runs(monkeypatch):
@@ -1,42 +0,0 @@
1
- import logging
2
-
3
- from custom_python_logger import build_logger, get_logger
4
-
5
-
6
- class LoggerTest:
7
- def __init__(self) -> None:
8
- self.logger = get_logger(self.__class__.__name__, extra={"class": self.__class__.__name__})
9
- print()
10
-
11
- def main(self) -> None:
12
- self.logger.debug("Hello World")
13
- self.logger.info("Hello World")
14
- self.logger.step("Hello World")
15
-
16
-
17
- def main() -> None:
18
- logger = build_logger(
19
- project_name="Logger Project Test",
20
- log_level=logging.DEBUG,
21
- log_file=True,
22
- # extra={'user': 'test_user'}
23
- )
24
-
25
- logger.debug("This is a debug message.")
26
- logger.info("This is an info message.")
27
- logger.step("This is a step message.")
28
- logger.warning("This is a warning message.")
29
-
30
- try:
31
- _ = 1 / 0
32
- except ZeroDivisionError:
33
- logger.exception("This is an exception message.")
34
-
35
- logger.critical("This is a critical message.")
36
-
37
- logger_test = LoggerTest()
38
- logger_test.main()
39
-
40
-
41
- if __name__ == "__main__":
42
- main()