custom-python-logger 1.0.10__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.
- custom_python_logger-1.0.11/PKG-INFO +125 -0
- custom_python_logger-1.0.11/README.md +98 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger/usage_example.py +2 -2
- custom_python_logger-1.0.11/custom_python_logger.egg-info/PKG-INFO +125 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/setup.py +1 -1
- custom_python_logger-1.0.10/PKG-INFO +0 -83
- custom_python_logger-1.0.10/README.md +0 -56
- custom_python_logger-1.0.10/custom_python_logger.egg-info/PKG-INFO +0 -83
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/LICENSE +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/MANIFEST.in +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger/__init__.py +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger/logger.py +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/SOURCES.txt +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/dependency_links.txt +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/requires.txt +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger.egg-info/top_level.txt +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/pyproject.toml +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/requirements.txt +0 -0
- {custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/setup.cfg +0 -0
- {custom_python_logger-1.0.10 → 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>
|
{custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger/usage_example.py
RENAMED
|
@@ -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,83 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: custom-python-logger
|
|
3
|
-
Version: 1.0.10
|
|
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.10
|
|
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>
|
|
File without changes
|
|
File without changes
|
{custom_python_logger-1.0.10 → custom_python_logger-1.0.11}/custom_python_logger/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|