custom-python-logger 1.0.9__tar.gz → 1.0.11__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-1.0.11/PKG-INFO +125 -0
  2. custom_python_logger-1.0.11/README.md +98 -0
  3. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger/logger.py +15 -10
  4. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger/usage_example.py +2 -2
  5. custom_python_logger-1.0.11/custom_python_logger.egg-info/PKG-INFO +125 -0
  6. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/setup.py +1 -1
  7. custom_python_logger-1.0.9/PKG-INFO +0 -83
  8. custom_python_logger-1.0.9/README.md +0 -56
  9. custom_python_logger-1.0.9/custom_python_logger.egg-info/PKG-INFO +0 -83
  10. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/LICENSE +0 -0
  11. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/MANIFEST.in +0 -0
  12. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger/__init__.py +0 -0
  13. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/SOURCES.txt +0 -0
  14. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/dependency_links.txt +0 -0
  15. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/requires.txt +0 -0
  16. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/top_level.txt +0 -0
  17. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/pyproject.toml +0 -0
  18. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/requirements.txt +0 -0
  19. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/setup.cfg +0 -0
  20. {custom_python_logger-1.0.9 → custom_python_logger-1.0.11}/tests/test_logger.py +0 -0
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: custom-python-logger
3
+ Version: 1.0.11
4
+ Summary: A custom logger with color support and additional features.
5
+ Home-page: https://github.com/aviz92/custom-python-logger
6
+ Author: Avi Zaguri
7
+ Author-email:
8
+ Project-URL: Repository, https://github.com/aviz92/custom-python-logger
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: setuptools
13
+ Requires-Dist: wheel
14
+ Requires-Dist: colorlog
15
+ Requires-Dist: pytest
16
+ Requires-Dist: pathlib
17
+ Requires-Dist: PyYAML
18
+ Dynamic: author
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: project-url
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # custom-python-logger
29
+ A powerful and flexible Python logger with colored output, custom log levels, and advanced configuration options. <br>
30
+ Easily integrate structured, readable, and context-rich logging into your Python projects for better debugging and monitoring.
31
+
32
+ ---
33
+
34
+ ## 🚀 Features
35
+ - ✅ **Colored Output**: Beautiful, readable logs in your terminal using `colorlog`.
36
+ - ✅ **Custom Log Levels**: Includes `STEP` (for process steps) and `EXCEPTION` (for exception tracking) in addition to standard levels.
37
+ - ✅ **Flexible Output**: Log to console, file, or both. Supports custom log file paths and automatic log directory creation.
38
+ - ✅ **Contextual Logging**: Add extra fields (like user, environment, etc.) to every log message.
39
+ - ✅ **UTC Support**: Optionally log timestamps in UTC for consistency across environments.
40
+ - ✅ **Pretty Formatting**: Built-in helpers for pretty-printing JSON and YAML data in logs.
41
+ - ✅ **Easy Integration**: Simple API for getting a ready-to-use logger anywhere in your codebase.
42
+
43
+ ---
44
+
45
+ ## 📦 Installation
46
+ ```bash
47
+ pip install custom-python-logger
48
+ ```
49
+
50
+ ---
51
+
52
+ ### 🔧 Usage
53
+ Here's a quick example of how to use `custom-python-logger` in your project:
54
+
55
+ ```python
56
+ import logging
57
+ from custom_python_logger import get_logger, CustomLoggerAdapter
58
+
59
+ logger: CustomLoggerAdapter = get_logger(
60
+ project_name='Logger Project Test',
61
+ log_level=logging.DEBUG,
62
+ log_file=True,
63
+ )
64
+
65
+ logger.debug("This is a debug message.")
66
+ logger.info("This is an info message.")
67
+ logger.step("This is a step message.")
68
+ logger.warning("This is a warning message.")
69
+
70
+ try:
71
+ _ = 1 / 0
72
+ except ZeroDivisionError:
73
+ logger.exception("This is an exception message.")
74
+
75
+ logger.critical("This is a critical message.")
76
+ ```
77
+
78
+ #### Advanced Usage
79
+ - Log to a file:
80
+ ```python
81
+ from custom_python_logger import get_logger, CustomLoggerAdapter
82
+
83
+ logger = get_logger(project_name='MyApp', log_file=True)
84
+ ```
85
+ - Use UTC timestamps:
86
+ ```python
87
+ from custom_python_logger import get_logger, CustomLoggerAdapter
88
+
89
+ logger = get_logger(project_name='MyApp', log_file=True, utc=True)
90
+ ```
91
+ - Add extra context:
92
+ ```python
93
+ from custom_python_logger import get_logger, CustomLoggerAdapter
94
+
95
+ logger = get_logger(project_name='MyApp', log_file=True, utc=True, extra={'user': 'alice'})
96
+ ```
97
+ - Pretty-print JSON or YAML:
98
+ ```python
99
+ from custom_python_logger import get_logger, CustomLoggerAdapter, json_pretty_format, yaml_pretty_format
100
+
101
+ logger = get_logger(project_name='MyApp', utc=True, log_file=True)
102
+
103
+ logger.info(json_pretty_format({'foo': 'bar'}))
104
+ logger.info(yaml_pretty_format({'foo': 'bar'}))
105
+ ```
106
+
107
+ ---
108
+
109
+ ## 🤝 Contributing
110
+ If you have a helpful tool, pattern, or improvement to suggest:
111
+ Fork the repo <br>
112
+ Create a new branch <br>
113
+ Submit a pull request <br>
114
+ I welcome additions that promote clean, productive, and maintainable development. <br>
115
+
116
+ ---
117
+
118
+ ## 📄 License
119
+ MIT License — see [LICENSE](LICENSE) for details.
120
+
121
+ ---
122
+
123
+ ## 🙏 Thanks
124
+ Thanks for exploring this repository! <br>
125
+ Happy coding! <br>
@@ -0,0 +1,98 @@
1
+ # custom-python-logger
2
+ A powerful and flexible Python logger with colored output, custom log levels, and advanced configuration options. <br>
3
+ Easily integrate structured, readable, and context-rich logging into your Python projects for better debugging and monitoring.
4
+
5
+ ---
6
+
7
+ ## 🚀 Features
8
+ - ✅ **Colored Output**: Beautiful, readable logs in your terminal using `colorlog`.
9
+ - ✅ **Custom Log Levels**: Includes `STEP` (for process steps) and `EXCEPTION` (for exception tracking) in addition to standard levels.
10
+ - ✅ **Flexible Output**: Log to console, file, or both. Supports custom log file paths and automatic log directory creation.
11
+ - ✅ **Contextual Logging**: Add extra fields (like user, environment, etc.) to every log message.
12
+ - ✅ **UTC Support**: Optionally log timestamps in UTC for consistency across environments.
13
+ - ✅ **Pretty Formatting**: Built-in helpers for pretty-printing JSON and YAML data in logs.
14
+ - ✅ **Easy Integration**: Simple API for getting a ready-to-use logger anywhere in your codebase.
15
+
16
+ ---
17
+
18
+ ## 📦 Installation
19
+ ```bash
20
+ pip install custom-python-logger
21
+ ```
22
+
23
+ ---
24
+
25
+ ### 🔧 Usage
26
+ Here's a quick example of how to use `custom-python-logger` in your project:
27
+
28
+ ```python
29
+ import logging
30
+ from custom_python_logger import get_logger, CustomLoggerAdapter
31
+
32
+ logger: CustomLoggerAdapter = get_logger(
33
+ project_name='Logger Project Test',
34
+ log_level=logging.DEBUG,
35
+ log_file=True,
36
+ )
37
+
38
+ logger.debug("This is a debug message.")
39
+ logger.info("This is an info message.")
40
+ logger.step("This is a step message.")
41
+ logger.warning("This is a warning message.")
42
+
43
+ try:
44
+ _ = 1 / 0
45
+ except ZeroDivisionError:
46
+ logger.exception("This is an exception message.")
47
+
48
+ logger.critical("This is a critical message.")
49
+ ```
50
+
51
+ #### Advanced Usage
52
+ - Log to a file:
53
+ ```python
54
+ from custom_python_logger import get_logger, CustomLoggerAdapter
55
+
56
+ logger = get_logger(project_name='MyApp', log_file=True)
57
+ ```
58
+ - Use UTC timestamps:
59
+ ```python
60
+ from custom_python_logger import get_logger, CustomLoggerAdapter
61
+
62
+ logger = get_logger(project_name='MyApp', log_file=True, utc=True)
63
+ ```
64
+ - Add extra context:
65
+ ```python
66
+ from custom_python_logger import get_logger, CustomLoggerAdapter
67
+
68
+ logger = get_logger(project_name='MyApp', log_file=True, utc=True, extra={'user': 'alice'})
69
+ ```
70
+ - Pretty-print JSON or YAML:
71
+ ```python
72
+ from custom_python_logger import get_logger, CustomLoggerAdapter, json_pretty_format, yaml_pretty_format
73
+
74
+ logger = get_logger(project_name='MyApp', utc=True, log_file=True)
75
+
76
+ logger.info(json_pretty_format({'foo': 'bar'}))
77
+ logger.info(yaml_pretty_format({'foo': 'bar'}))
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 🤝 Contributing
83
+ If you have a helpful tool, pattern, or improvement to suggest:
84
+ Fork the repo <br>
85
+ Create a new branch <br>
86
+ Submit a pull request <br>
87
+ I welcome additions that promote clean, productive, and maintainable development. <br>
88
+
89
+ ---
90
+
91
+ ## 📄 License
92
+ MIT License — see [LICENSE](LICENSE) for details.
93
+
94
+ ---
95
+
96
+ ## 🙏 Thanks
97
+ Thanks for exploring this repository! <br>
98
+ Happy coding! <br>
@@ -44,7 +44,8 @@ def configure_logging(
44
44
  log_format: str,
45
45
  utc: bool,
46
46
  log_level: int = logging.INFO,
47
- log_file: Optional[str] = None,
47
+ log_file: bool = False,
48
+ log_file_path: Optional[str] = None,
48
49
  console_output: bool = True,
49
50
  ) -> None:
50
51
  """
@@ -53,7 +54,8 @@ def configure_logging(
53
54
  Args:
54
55
  log_level: Logging level (default: INFO)
55
56
  log_format: Format string for log messages
56
- log_file: Path to log file (if None, no file logging)
57
+ log_file: Whether to log to a file
58
+ log_file_path: Path to log file (if None, no file logging)
57
59
  console_output: Whether to output logs to console
58
60
  utc: Whether to use UTC time for log timestamps
59
61
  """
@@ -68,15 +70,15 @@ def configure_logging(
68
70
  root_logger.removeHandler(handler)
69
71
 
70
72
  # Add file handler if specified
71
- if log_file is not None:
73
+ if log_file and log_file_path is not None:
72
74
  log_file_formatter = logging.Formatter(log_format)
73
75
 
74
76
  # Create directory if it doesn't exist
75
- log_dir = os.path.dirname(log_file)
77
+ log_dir = os.path.dirname(log_file_path)
76
78
  if log_dir and not os.path.exists(log_dir):
77
79
  os.makedirs(log_dir)
78
80
 
79
- file_handler = logging.FileHandler(log_file)
81
+ file_handler = logging.FileHandler(log_file_path)
80
82
 
81
83
  file_handler.setFormatter(log_file_formatter)
82
84
  root_logger.addHandler(file_handler)
@@ -107,7 +109,8 @@ def get_logger(
107
109
  extra: Optional[dict[str, Any]] = None,
108
110
  log_format: str = "%(asctime)s | %(levelname)-10s(l.%(levelno)s) | %(filename)s:%(lineno)s | %(message)s",
109
111
  log_level: int = logging.INFO,
110
- log_file: str = None,
112
+ log_file: bool = False,
113
+ log_file_path: str = None,
111
114
  console_output: bool = True,
112
115
  utc: bool = False,
113
116
  ) -> CustomLoggerAdapter[Logger | LoggerAdapter[Any] | Any] | Logger:
@@ -119,7 +122,8 @@ def get_logger(
119
122
  log_level: Optional specific log level
120
123
  extra: Optional dictionary of extra context values
121
124
  log_format: Format string for log messages
122
- log_file: Path to log file (if None, no file logging)
125
+ log_file: Whether to log to a file
126
+ log_file_path: Path to log file (if None, no file logging)
123
127
  console_output: Whether to output logs to console
124
128
  utc: Whether to use UTC time for log timestamps
125
129
 
@@ -128,14 +132,15 @@ def get_logger(
128
132
  """
129
133
  print_before_logger(project_name=project_name)
130
134
 
131
- if not log_file:
132
- log_file = f'{get_root_project_path()}/logs/{project_name}.log'
133
- log_file = log_file.lower().replace(' ', '_')
135
+ if not log_file_path:
136
+ log_file_path = f'{get_root_project_path()}/logs/{project_name}.log'
137
+ log_file_path = log_file_path.lower().replace(' ', '_')
134
138
 
135
139
  configure_logging(
136
140
  log_level=logging.DEBUG,
137
141
  log_format=log_format,
138
142
  log_file=log_file,
143
+ log_file_path=log_file_path,
139
144
  console_output=console_output,
140
145
  utc=utc
141
146
  )
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from custom_python_logger import get_logger
2
3
 
3
4
 
4
5
  class LoggerTest:
@@ -11,11 +12,10 @@ class LoggerTest:
11
12
 
12
13
 
13
14
  def main():
14
- from custom_python_logger.logger import get_logger
15
-
16
15
  logger = get_logger(
17
16
  project_name='Logger Project Test',
18
17
  log_level=logging.DEBUG,
18
+ log_file=True,
19
19
  # extra={'user': 'test_user'}
20
20
  )
21
21
 
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: custom-python-logger
3
+ Version: 1.0.11
4
+ Summary: A custom logger with color support and additional features.
5
+ Home-page: https://github.com/aviz92/custom-python-logger
6
+ Author: Avi Zaguri
7
+ Author-email:
8
+ Project-URL: Repository, https://github.com/aviz92/custom-python-logger
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: setuptools
13
+ Requires-Dist: wheel
14
+ Requires-Dist: colorlog
15
+ Requires-Dist: pytest
16
+ Requires-Dist: pathlib
17
+ Requires-Dist: PyYAML
18
+ Dynamic: author
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: project-url
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # custom-python-logger
29
+ A powerful and flexible Python logger with colored output, custom log levels, and advanced configuration options. <br>
30
+ Easily integrate structured, readable, and context-rich logging into your Python projects for better debugging and monitoring.
31
+
32
+ ---
33
+
34
+ ## 🚀 Features
35
+ - ✅ **Colored Output**: Beautiful, readable logs in your terminal using `colorlog`.
36
+ - ✅ **Custom Log Levels**: Includes `STEP` (for process steps) and `EXCEPTION` (for exception tracking) in addition to standard levels.
37
+ - ✅ **Flexible Output**: Log to console, file, or both. Supports custom log file paths and automatic log directory creation.
38
+ - ✅ **Contextual Logging**: Add extra fields (like user, environment, etc.) to every log message.
39
+ - ✅ **UTC Support**: Optionally log timestamps in UTC for consistency across environments.
40
+ - ✅ **Pretty Formatting**: Built-in helpers for pretty-printing JSON and YAML data in logs.
41
+ - ✅ **Easy Integration**: Simple API for getting a ready-to-use logger anywhere in your codebase.
42
+
43
+ ---
44
+
45
+ ## 📦 Installation
46
+ ```bash
47
+ pip install custom-python-logger
48
+ ```
49
+
50
+ ---
51
+
52
+ ### 🔧 Usage
53
+ Here's a quick example of how to use `custom-python-logger` in your project:
54
+
55
+ ```python
56
+ import logging
57
+ from custom_python_logger import get_logger, CustomLoggerAdapter
58
+
59
+ logger: CustomLoggerAdapter = get_logger(
60
+ project_name='Logger Project Test',
61
+ log_level=logging.DEBUG,
62
+ log_file=True,
63
+ )
64
+
65
+ logger.debug("This is a debug message.")
66
+ logger.info("This is an info message.")
67
+ logger.step("This is a step message.")
68
+ logger.warning("This is a warning message.")
69
+
70
+ try:
71
+ _ = 1 / 0
72
+ except ZeroDivisionError:
73
+ logger.exception("This is an exception message.")
74
+
75
+ logger.critical("This is a critical message.")
76
+ ```
77
+
78
+ #### Advanced Usage
79
+ - Log to a file:
80
+ ```python
81
+ from custom_python_logger import get_logger, CustomLoggerAdapter
82
+
83
+ logger = get_logger(project_name='MyApp', log_file=True)
84
+ ```
85
+ - Use UTC timestamps:
86
+ ```python
87
+ from custom_python_logger import get_logger, CustomLoggerAdapter
88
+
89
+ logger = get_logger(project_name='MyApp', log_file=True, utc=True)
90
+ ```
91
+ - Add extra context:
92
+ ```python
93
+ from custom_python_logger import get_logger, CustomLoggerAdapter
94
+
95
+ logger = get_logger(project_name='MyApp', log_file=True, utc=True, extra={'user': 'alice'})
96
+ ```
97
+ - Pretty-print JSON or YAML:
98
+ ```python
99
+ from custom_python_logger import get_logger, CustomLoggerAdapter, json_pretty_format, yaml_pretty_format
100
+
101
+ logger = get_logger(project_name='MyApp', utc=True, log_file=True)
102
+
103
+ logger.info(json_pretty_format({'foo': 'bar'}))
104
+ logger.info(yaml_pretty_format({'foo': 'bar'}))
105
+ ```
106
+
107
+ ---
108
+
109
+ ## 🤝 Contributing
110
+ If you have a helpful tool, pattern, or improvement to suggest:
111
+ Fork the repo <br>
112
+ Create a new branch <br>
113
+ Submit a pull request <br>
114
+ I welcome additions that promote clean, productive, and maintainable development. <br>
115
+
116
+ ---
117
+
118
+ ## 📄 License
119
+ MIT License — see [LICENSE](LICENSE) for details.
120
+
121
+ ---
122
+
123
+ ## 🙏 Thanks
124
+ Thanks for exploring this repository! <br>
125
+ Happy coding! <br>
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- package_version = '1.0.9'
3
+ package_version = '1.0.11'
4
4
 
5
5
  package_name = 'custom-python-logger'
6
6
  package_description = 'A custom logger with color support and additional features.'
@@ -1,83 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: custom-python-logger
3
- Version: 1.0.9
4
- Summary: A custom logger with color support and additional features.
5
- Home-page: https://github.com/aviz92/custom-python-logger
6
- Author: Avi Zaguri
7
- Author-email:
8
- Project-URL: Repository, https://github.com/aviz92/custom-python-logger
9
- Requires-Python: >=3.11
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: setuptools
13
- Requires-Dist: wheel
14
- Requires-Dist: colorlog
15
- Requires-Dist: pytest
16
- Requires-Dist: pathlib
17
- Requires-Dist: PyYAML
18
- Dynamic: author
19
- Dynamic: description
20
- Dynamic: description-content-type
21
- Dynamic: home-page
22
- Dynamic: license-file
23
- Dynamic: project-url
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
-
28
- # Custom Logger
29
- A Python logger with colored output and additional log levels. <br>
30
- The logger supports custom log levels like `STEP` and `EXCEPTION` and can be easily integrated into your Python projects.
31
-
32
- ## Installation
33
- You can install the package using pip:
34
- ```bash
35
- pip install custom-python-logger
36
- ```
37
-
38
- ## Usage
39
- ```python
40
- import logging
41
- from custom_python_logger.logger import get_logger, CustomLoggerAdapter
42
-
43
- logger: CustomLoggerAdapter = CustomLoggerAdapter(logging.getLogger(__name__))
44
-
45
-
46
- def main():
47
- logger.debug("This is a debug message.")
48
- logger.info("This is an info message.")
49
- logger.step("This is a step message.")
50
- logger.warning("This is a warning message.")
51
-
52
- try:
53
- _ = 1 / 0
54
- except ZeroDivisionError:
55
- logger.exception("This is an exception message.")
56
-
57
- logger.critical("This is a critical message.")
58
-
59
-
60
- if __name__ == '__main__':
61
- _ = get_logger(
62
- project_name='Logger Project Test',
63
- log_level=logging.DEBUG,
64
- extra={'user': 'test_user'}
65
- )
66
-
67
- main()
68
- ```
69
-
70
- ---
71
-
72
- ## 🤝 Contributing
73
- If you have a helpful tool, pattern, or improvement to suggest:
74
- Fork the repo <br>
75
- Create a new branch <br>
76
- Submit a pull request <br>
77
- I welcome additions that promote clean, productive, and maintainable development. <br>
78
-
79
- ---
80
-
81
- ## 🙏 Thanks
82
- Thanks for exploring this repository! <br>
83
- Happy coding! <br>
@@ -1,56 +0,0 @@
1
- # Custom Logger
2
- A Python logger with colored output and additional log levels. <br>
3
- The logger supports custom log levels like `STEP` and `EXCEPTION` and can be easily integrated into your Python projects.
4
-
5
- ## Installation
6
- You can install the package using pip:
7
- ```bash
8
- pip install custom-python-logger
9
- ```
10
-
11
- ## Usage
12
- ```python
13
- import logging
14
- from custom_python_logger.logger import get_logger, CustomLoggerAdapter
15
-
16
- logger: CustomLoggerAdapter = CustomLoggerAdapter(logging.getLogger(__name__))
17
-
18
-
19
- def main():
20
- logger.debug("This is a debug message.")
21
- logger.info("This is an info message.")
22
- logger.step("This is a step message.")
23
- logger.warning("This is a warning message.")
24
-
25
- try:
26
- _ = 1 / 0
27
- except ZeroDivisionError:
28
- logger.exception("This is an exception message.")
29
-
30
- logger.critical("This is a critical message.")
31
-
32
-
33
- if __name__ == '__main__':
34
- _ = get_logger(
35
- project_name='Logger Project Test',
36
- log_level=logging.DEBUG,
37
- extra={'user': 'test_user'}
38
- )
39
-
40
- main()
41
- ```
42
-
43
- ---
44
-
45
- ## 🤝 Contributing
46
- If you have a helpful tool, pattern, or improvement to suggest:
47
- Fork the repo <br>
48
- Create a new branch <br>
49
- Submit a pull request <br>
50
- I welcome additions that promote clean, productive, and maintainable development. <br>
51
-
52
- ---
53
-
54
- ## 🙏 Thanks
55
- Thanks for exploring this repository! <br>
56
- Happy coding! <br>
@@ -1,83 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: custom-python-logger
3
- Version: 1.0.9
4
- Summary: A custom logger with color support and additional features.
5
- Home-page: https://github.com/aviz92/custom-python-logger
6
- Author: Avi Zaguri
7
- Author-email:
8
- Project-URL: Repository, https://github.com/aviz92/custom-python-logger
9
- Requires-Python: >=3.11
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: setuptools
13
- Requires-Dist: wheel
14
- Requires-Dist: colorlog
15
- Requires-Dist: pytest
16
- Requires-Dist: pathlib
17
- Requires-Dist: PyYAML
18
- Dynamic: author
19
- Dynamic: description
20
- Dynamic: description-content-type
21
- Dynamic: home-page
22
- Dynamic: license-file
23
- Dynamic: project-url
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
-
28
- # Custom Logger
29
- A Python logger with colored output and additional log levels. <br>
30
- The logger supports custom log levels like `STEP` and `EXCEPTION` and can be easily integrated into your Python projects.
31
-
32
- ## Installation
33
- You can install the package using pip:
34
- ```bash
35
- pip install custom-python-logger
36
- ```
37
-
38
- ## Usage
39
- ```python
40
- import logging
41
- from custom_python_logger.logger import get_logger, CustomLoggerAdapter
42
-
43
- logger: CustomLoggerAdapter = CustomLoggerAdapter(logging.getLogger(__name__))
44
-
45
-
46
- def main():
47
- logger.debug("This is a debug message.")
48
- logger.info("This is an info message.")
49
- logger.step("This is a step message.")
50
- logger.warning("This is a warning message.")
51
-
52
- try:
53
- _ = 1 / 0
54
- except ZeroDivisionError:
55
- logger.exception("This is an exception message.")
56
-
57
- logger.critical("This is a critical message.")
58
-
59
-
60
- if __name__ == '__main__':
61
- _ = get_logger(
62
- project_name='Logger Project Test',
63
- log_level=logging.DEBUG,
64
- extra={'user': 'test_user'}
65
- )
66
-
67
- main()
68
- ```
69
-
70
- ---
71
-
72
- ## 🤝 Contributing
73
- If you have a helpful tool, pattern, or improvement to suggest:
74
- Fork the repo <br>
75
- Create a new branch <br>
76
- Submit a pull request <br>
77
- I welcome additions that promote clean, productive, and maintainable development. <br>
78
-
79
- ---
80
-
81
- ## 🙏 Thanks
82
- Thanks for exploring this repository! <br>
83
- Happy coding! <br>