custom-python-logger 1.0.3__tar.gz → 1.0.4__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 (17) hide show
  1. {custom_python_logger-1.0.3/custom_python_logger.egg-info → custom_python_logger-1.0.4}/PKG-INFO +1 -1
  2. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger/__init__.py +1 -1
  3. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger/logger.py +23 -13
  4. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4/custom_python_logger.egg-info}/PKG-INFO +1 -1
  5. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/setup.py +1 -1
  6. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/LICENSE +0 -0
  7. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/MANIFEST.in +0 -0
  8. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/README.md +0 -0
  9. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger/usage_example.py +0 -0
  10. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger.egg-info/SOURCES.txt +0 -0
  11. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger.egg-info/dependency_links.txt +0 -0
  12. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger.egg-info/requires.txt +0 -0
  13. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/custom_python_logger.egg-info/top_level.txt +0 -0
  14. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/pyproject.toml +0 -0
  15. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/requirements.txt +0 -0
  16. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/setup.cfg +0 -0
  17. {custom_python_logger-1.0.3 → custom_python_logger-1.0.4}/tests/test_logger.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: custom-python-logger
3
- Version: 1.0.3
3
+ Version: 1.0.4
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,3 +1,3 @@
1
1
  from custom_python_logger.logger import get_logger
2
2
 
3
- __all__ = ['get_logger']
3
+ __all__ = ["get_logger", "json_pretty_format"]
@@ -1,5 +1,5 @@
1
1
  # logger.py
2
-
2
+ import json
3
3
  import logging
4
4
  import os
5
5
  import time
@@ -14,6 +14,7 @@ def get_root_project_path() -> Path:
14
14
  return Path(__file__).parents[5]
15
15
  return Path(__file__).parent
16
16
 
17
+
17
18
  def print_before_logger(project_name: str) -> None:
18
19
  main_string = f'Start "{project_name}" Process'
19
20
 
@@ -39,11 +40,11 @@ class CustomLoggerAdapter(logging.LoggerAdapter):
39
40
 
40
41
 
41
42
  def configure_logging(
42
- log_format: str,
43
- utc: bool,
44
- log_level: int = logging.INFO,
45
- log_file: Optional[str] = None,
46
- console_output: bool = True,
43
+ log_format: str,
44
+ utc: bool,
45
+ log_level: int = logging.INFO,
46
+ log_file: Optional[str] = None,
47
+ console_output: bool = True,
47
48
  ) -> None:
48
49
  """
49
50
  Configure global logging settings.
@@ -101,13 +102,13 @@ def configure_logging(
101
102
 
102
103
 
103
104
  def get_logger(
104
- project_name: str,
105
- extra: Optional[dict[str, Any]] = None,
106
- log_format: str = "%(asctime)s | %(levelname)-10s(l.%(levelno)s) | %(filename)s:%(lineno)s | %(message)s",
107
- log_level: int = logging.INFO,
108
- log_file: str = None,
109
- console_output: bool = True,
110
- utc: bool = False,
105
+ project_name: str,
106
+ extra: Optional[dict[str, Any]] = None,
107
+ log_format: str = "%(asctime)s | %(levelname)-10s(l.%(levelno)s) | %(filename)s:%(lineno)s | %(message)s",
108
+ log_level: int = logging.INFO,
109
+ log_file: str = None,
110
+ console_output: bool = True,
111
+ utc: bool = False,
111
112
  ) -> CustomLoggerAdapter[Logger | LoggerAdapter[Any] | Any] | Logger:
112
113
  """
113
114
  Get a named logger with optional extra context.
@@ -144,3 +145,12 @@ def get_logger(
144
145
  logger.setLevel(log_level)
145
146
 
146
147
  return CustomLoggerAdapter(logger, extra)
148
+
149
+
150
+ def json_pretty_format(
151
+ data: any,
152
+ indent: int = 4,
153
+ sort_keys: bool = True,
154
+ default: callable = None
155
+ ) -> str:
156
+ return json.dumps(data, indent=indent, sort_keys=sort_keys, default=default)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: custom-python-logger
3
- Version: 1.0.3
3
+ Version: 1.0.4
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,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- package_version = '1.0.3'
3
+ package_version = '1.0.4'
4
4
 
5
5
  package_name = 'custom-python-logger'
6
6
  package_description = 'A custom logger with color support and additional features.'