VersaLog 2.5.5__tar.gz → 3.0.0__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.
- {versalog-2.5.5/VersaLog.egg-info → versalog-3.0.0}/PKG-INFO +74 -12
- versalog-2.5.5/PKG-INFO → versalog-3.0.0/README.md +64 -31
- versalog-3.0.0/VersaLog/__init__.py +13 -0
- {versalog-2.5.5 → versalog-3.0.0}/VersaLog/core.py +29 -0
- versalog-3.0.0/VersaLog/integrations/auto.py +32 -0
- versalog-3.0.0/VersaLog/integrations/django.py +19 -0
- versalog-3.0.0/VersaLog/integrations/flask.py +8 -0
- versalog-3.0.0/VersaLog/integrations/generic.py +14 -0
- versalog-3.0.0/VersaLog/integrations/webhook/__init__.py +3 -0
- versalog-3.0.0/VersaLog/integrations/webhook/formatters.py +17 -0
- versalog-3.0.0/VersaLog/integrations/webhook/handler.py +43 -0
- versalog-3.0.0/VersaLog/integrations/webhook/sender.py +16 -0
- versalog-2.5.5/README.md → versalog-3.0.0/VersaLog.egg-info/PKG-INFO +93 -11
- versalog-3.0.0/VersaLog.egg-info/SOURCES.txt +21 -0
- versalog-3.0.0/VersaLog.egg-info/requires.txt +1 -0
- {versalog-2.5.5 → versalog-3.0.0}/setup.py +4 -2
- versalog-2.5.5/VersaLog/__init__.py +0 -10
- versalog-2.5.5/VersaLog.egg-info/SOURCES.txt +0 -12
- {versalog-2.5.5 → versalog-3.0.0}/LICENSE +0 -0
- {versalog-2.5.5 → versalog-3.0.0}/VersaLog/handler.py +0 -0
- {versalog-2.5.5 → versalog-3.0.0}/VersaLog/integrations/__init__.py +0 -0
- {versalog-2.5.5 → versalog-3.0.0}/VersaLog/integrations/fastapi.py +0 -0
- {versalog-2.5.5 → versalog-3.0.0}/VersaLog.egg-info/dependency_links.txt +0 -0
- {versalog-2.5.5 → versalog-3.0.0}/VersaLog.egg-info/top_level.txt +0 -0
- {versalog-2.5.5 → versalog-3.0.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: VersaLog
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Versatile logging library.
|
|
5
5
|
Home-page:
|
|
6
6
|
Author:
|
|
@@ -17,6 +17,15 @@ Classifier: Operating System :: OS Independent
|
|
|
17
17
|
Requires-Python: >=3.8, <3.14
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
+
Requires-Dist: plyer
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
20
29
|
|
|
21
30
|
## What is VersaLog.py?
|
|
22
31
|
|
|
@@ -27,8 +36,69 @@ License-File: LICENSE
|
|
|
27
36
|
[](https://discord.gg/Ms2ejEES)
|
|
28
37
|
|
|
29
38
|
What is VersaLog.py?
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
|
|
40
|
+
VersaLog is a modern, powerful, and flexible logging library for Python.
|
|
41
|
+
It supports everything from simple usage to advanced, highly customizable configurations, making it suitable for a wide range of use cases.
|
|
42
|
+
|
|
43
|
+
## Feature
|
|
44
|
+
|
|
45
|
+
### Basic Logging
|
|
46
|
+
|
|
47
|
+
- Supports standard log levels:
|
|
48
|
+
- `INFO`, `ERROR`, `WARNING`, `DEBUG`, `CRITICAL`
|
|
49
|
+
- Colored output for better readability
|
|
50
|
+
- Symbol-based prefixes (e.g. `[+]`, `[-]`, `[!]`)
|
|
51
|
+
|
|
52
|
+
### Multiple Output Formats
|
|
53
|
+
|
|
54
|
+
**Easily switch between different log styles:**
|
|
55
|
+
|
|
56
|
+
- `simple` → `[+] message`
|
|
57
|
+
- `simple2` → `[TIME] [+] message`
|
|
58
|
+
- `detailed` → `[TIME][LEVEL] : message`
|
|
59
|
+
- `file` → `[FILE:LINE][LEVEL] message`
|
|
60
|
+
|
|
61
|
+
### Tag System
|
|
62
|
+
|
|
63
|
+
- Add custom tags to logs
|
|
64
|
+
- Supports multiple tags (e.g. `["API", "AUTH"]`)
|
|
65
|
+
- Optional default tags
|
|
66
|
+
|
|
67
|
+
### File & Line Tracking
|
|
68
|
+
|
|
69
|
+
- Display caller file name and line number
|
|
70
|
+
- Useful for debugging large projects
|
|
71
|
+
|
|
72
|
+
### Log File Saving
|
|
73
|
+
|
|
74
|
+
- Automatically save logs to files
|
|
75
|
+
- Output path: `./log/YYYY-MM-DD.log`
|
|
76
|
+
- Select which log levels to save
|
|
77
|
+
|
|
78
|
+
### Auto Cleanup
|
|
79
|
+
|
|
80
|
+
- Automatically deletes old log files (default: 7 days)
|
|
81
|
+
- Keeps your log directory clean
|
|
82
|
+
|
|
83
|
+
### Auto Cleanup
|
|
84
|
+
|
|
85
|
+
- Disable console output
|
|
86
|
+
- Useful for background services
|
|
87
|
+
|
|
88
|
+
### Exception Handling
|
|
89
|
+
|
|
90
|
+
- Automatically captures unhandled exceptions
|
|
91
|
+
- Logs them as `CRITICAL`
|
|
92
|
+
|
|
93
|
+
### Desktop Notifications
|
|
94
|
+
|
|
95
|
+
- Optional desktop alerts for errors and critical logs
|
|
96
|
+
- Uses `plyer.notification`
|
|
97
|
+
|
|
98
|
+
### Asynchronous Logging
|
|
99
|
+
|
|
100
|
+
- Non-blocking log processing using threads and queues
|
|
101
|
+
- Improves performance in high-load environments
|
|
32
102
|
|
|
33
103
|
## Support
|
|
34
104
|
|
|
@@ -74,12 +144,4 @@ logger = VersaLog(enum="detailed", tag="a", show_tag=True)
|
|
|
74
144
|
|
|
75
145
|
# two tag
|
|
76
146
|
logger = VersaLog(enum="detailed", tag=["a", "a"], show_tag=True)
|
|
77
|
-
``` |
|
|
78
|
-
|
|
79
|
-
## Log save
|
|
80
|
-
|
|
81
|
-
````
|
|
82
|
-
|
|
83
|
-
[2025-08-06 04:10:36][INFO] : ok
|
|
84
|
-
|
|
85
147
|
```
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: VersaLog
|
|
3
|
-
Version: 2.5.5
|
|
4
|
-
Summary: Versatile logging library.
|
|
5
|
-
Home-page:
|
|
6
|
-
Author:
|
|
7
|
-
License: MIT
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
|
-
Requires-Python: >=3.8, <3.14
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
License-File: LICENSE
|
|
20
|
-
|
|
21
1
|
## What is VersaLog.py?
|
|
22
2
|
|
|
23
3
|
[](https://badge.fury.io/py/VersaLog)
|
|
@@ -27,8 +7,69 @@ License-File: LICENSE
|
|
|
27
7
|
[](https://discord.gg/Ms2ejEES)
|
|
28
8
|
|
|
29
9
|
What is VersaLog.py?
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
|
|
11
|
+
VersaLog is a modern, powerful, and flexible logging library for Python.
|
|
12
|
+
It supports everything from simple usage to advanced, highly customizable configurations, making it suitable for a wide range of use cases.
|
|
13
|
+
|
|
14
|
+
## Feature
|
|
15
|
+
|
|
16
|
+
### Basic Logging
|
|
17
|
+
|
|
18
|
+
- Supports standard log levels:
|
|
19
|
+
- `INFO`, `ERROR`, `WARNING`, `DEBUG`, `CRITICAL`
|
|
20
|
+
- Colored output for better readability
|
|
21
|
+
- Symbol-based prefixes (e.g. `[+]`, `[-]`, `[!]`)
|
|
22
|
+
|
|
23
|
+
### Multiple Output Formats
|
|
24
|
+
|
|
25
|
+
**Easily switch between different log styles:**
|
|
26
|
+
|
|
27
|
+
- `simple` → `[+] message`
|
|
28
|
+
- `simple2` → `[TIME] [+] message`
|
|
29
|
+
- `detailed` → `[TIME][LEVEL] : message`
|
|
30
|
+
- `file` → `[FILE:LINE][LEVEL] message`
|
|
31
|
+
|
|
32
|
+
### Tag System
|
|
33
|
+
|
|
34
|
+
- Add custom tags to logs
|
|
35
|
+
- Supports multiple tags (e.g. `["API", "AUTH"]`)
|
|
36
|
+
- Optional default tags
|
|
37
|
+
|
|
38
|
+
### File & Line Tracking
|
|
39
|
+
|
|
40
|
+
- Display caller file name and line number
|
|
41
|
+
- Useful for debugging large projects
|
|
42
|
+
|
|
43
|
+
### Log File Saving
|
|
44
|
+
|
|
45
|
+
- Automatically save logs to files
|
|
46
|
+
- Output path: `./log/YYYY-MM-DD.log`
|
|
47
|
+
- Select which log levels to save
|
|
48
|
+
|
|
49
|
+
### Auto Cleanup
|
|
50
|
+
|
|
51
|
+
- Automatically deletes old log files (default: 7 days)
|
|
52
|
+
- Keeps your log directory clean
|
|
53
|
+
|
|
54
|
+
### Auto Cleanup
|
|
55
|
+
|
|
56
|
+
- Disable console output
|
|
57
|
+
- Useful for background services
|
|
58
|
+
|
|
59
|
+
### Exception Handling
|
|
60
|
+
|
|
61
|
+
- Automatically captures unhandled exceptions
|
|
62
|
+
- Logs them as `CRITICAL`
|
|
63
|
+
|
|
64
|
+
### Desktop Notifications
|
|
65
|
+
|
|
66
|
+
- Optional desktop alerts for errors and critical logs
|
|
67
|
+
- Uses `plyer.notification`
|
|
68
|
+
|
|
69
|
+
### Asynchronous Logging
|
|
70
|
+
|
|
71
|
+
- Non-blocking log processing using threads and queues
|
|
72
|
+
- Improves performance in high-load environments
|
|
32
73
|
|
|
33
74
|
## Support
|
|
34
75
|
|
|
@@ -74,12 +115,4 @@ logger = VersaLog(enum="detailed", tag="a", show_tag=True)
|
|
|
74
115
|
|
|
75
116
|
# two tag
|
|
76
117
|
logger = VersaLog(enum="detailed", tag=["a", "a"], show_tag=True)
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Log save
|
|
80
|
-
|
|
81
|
-
````
|
|
82
|
-
|
|
83
|
-
[2025-08-06 04:10:36][INFO] : ok
|
|
84
|
-
|
|
85
|
-
```
|
|
118
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .core import VersaLog
|
|
2
|
+
from .handler import VersaLogHandler
|
|
3
|
+
from .integrations.auto import auto_setup
|
|
4
|
+
from .integrations.fastapi import setup_fastapi_logging
|
|
5
|
+
from .integrations.flask import setup_flask_logging
|
|
6
|
+
from .integrations.django import setup_django_logging
|
|
7
|
+
from .integrations.webhook import WebhookHandler
|
|
8
|
+
|
|
9
|
+
__copyright__ = "Copyright 2025 by Kayu0514"
|
|
10
|
+
__version__ = "3.0.0"
|
|
11
|
+
__author__ = "Kayu0514"
|
|
12
|
+
__url__ = "https://github.com/kayu0514"
|
|
13
|
+
__all__ = ["VersaLog", "VersaLogHandler", "WebhookHandler", "auto_setup", "setup_fastapi_logging","setup_flask_logging", "setup_django_logging"]
|
|
@@ -2,6 +2,8 @@ from typing import Optional, Union, List
|
|
|
2
2
|
from plyer import notification
|
|
3
3
|
from contextlib import contextmanager
|
|
4
4
|
|
|
5
|
+
from .integrations.webhook import WebhookHandler
|
|
6
|
+
|
|
5
7
|
import datetime
|
|
6
8
|
import inspect
|
|
7
9
|
import os
|
|
@@ -73,6 +75,7 @@ class VersaLog:
|
|
|
73
75
|
self.all_save = all_save
|
|
74
76
|
self.save_levels = save_levels
|
|
75
77
|
self.silent = silent
|
|
78
|
+
self._webhook_handlers = []
|
|
76
79
|
|
|
77
80
|
self.log_queue = queue.Queue()
|
|
78
81
|
self.worker_thread = threading.Thread(target=self._worker, daemon=True)
|
|
@@ -218,6 +221,32 @@ class VersaLog:
|
|
|
218
221
|
|
|
219
222
|
self._save_log(plain, types)
|
|
220
223
|
|
|
224
|
+
def add_webhook(self, url: str, level: str = "ERROR", *, format: str = "generic", timeout: float = 3.0, headers: Optional[dict] = None,):
|
|
225
|
+
"""Register a webhook destination for logs at or above ``level``.
|
|
226
|
+
|
|
227
|
+
``format`` can be ``"generic"``, ``"discord"``, or ``"slack"``.
|
|
228
|
+
The default ``"ERROR"`` sends ERROR and CRITICAL logs.
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
handler = WebhookHandler(url=url, level=level, format=format, timeout=timeout, headers=headers)
|
|
232
|
+
self._webhook_handlers.append(handler)
|
|
233
|
+
return handler
|
|
234
|
+
|
|
235
|
+
def remove_webhook(self, handler) -> bool:
|
|
236
|
+
try:
|
|
237
|
+
self._webhook_handlers.remove(handler)
|
|
238
|
+
return True
|
|
239
|
+
except ValueError:
|
|
240
|
+
return False
|
|
241
|
+
|
|
242
|
+
def _dispatch_webhooks(self, message: str, level: str) -> None:
|
|
243
|
+
for handler in tuple(self._webhook_handlers):
|
|
244
|
+
if handler.should_handle(level):
|
|
245
|
+
try:
|
|
246
|
+
handler.emit(message, level)
|
|
247
|
+
except Exception:
|
|
248
|
+
pass
|
|
249
|
+
|
|
221
250
|
def info(self, msg: str, tag: Optional[Union[str, List[str]]] = None) -> None:
|
|
222
251
|
self._Log(msg, "INFO", tag)
|
|
223
252
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from .generic import setup_logging
|
|
4
|
+
from .fastapi import setup_fastapi_logging
|
|
5
|
+
from .flask import setup_flask_logging
|
|
6
|
+
from .django import setup_django_logging
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def auto_setup(versalog):
|
|
10
|
+
"""
|
|
11
|
+
Automatically detects the runtime environment
|
|
12
|
+
and applies the appropriate logging configuration.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
if "uvicorn" in sys.modules:
|
|
16
|
+
setup_fastapi_logging(versalog)
|
|
17
|
+
return "fastapi"
|
|
18
|
+
|
|
19
|
+
if "gunicorn" in sys.modules:
|
|
20
|
+
setup_fastapi_logging(versalog)
|
|
21
|
+
return "gunicorn"
|
|
22
|
+
|
|
23
|
+
if "flask" in sys.modules:
|
|
24
|
+
setup_flask_logging(None, versalog)
|
|
25
|
+
return "flask"
|
|
26
|
+
|
|
27
|
+
if "django" in sys.modules:
|
|
28
|
+
setup_django_logging(versalog)
|
|
29
|
+
return "django"
|
|
30
|
+
|
|
31
|
+
setup_logging(versalog)
|
|
32
|
+
return "generic"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from ..handler import VersaLogHandle
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def setup_django_logging(versalog):
|
|
6
|
+
handler = VersaLogHandler(versalog)
|
|
7
|
+
|
|
8
|
+
root = logging.getLogger()
|
|
9
|
+
for h in root.handlers[:]:
|
|
10
|
+
root.removeHandler(h)
|
|
11
|
+
root.setLevel(logging.NOTSET)
|
|
12
|
+
root.addHandler(handler)
|
|
13
|
+
|
|
14
|
+
for name in ["django", "django.request", "django.server", "django.db.backends"]:
|
|
15
|
+
logger = logging.getLogger(name)
|
|
16
|
+
for h in logger.handlers[:]:
|
|
17
|
+
logger.removeHandler(h)
|
|
18
|
+
logger.propagate = True
|
|
19
|
+
logger.setLevel(logging.NOTSET)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from ..handler import VersaLogHandler
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def setup_logging(versalog):
|
|
6
|
+
handler = VersaLogHandler(versalog)
|
|
7
|
+
|
|
8
|
+
root = logging.getLogger()
|
|
9
|
+
|
|
10
|
+
for h in root.handlers[:]:
|
|
11
|
+
root.removeHandler(h)
|
|
12
|
+
|
|
13
|
+
root.setLevel(logging.NOTSET)
|
|
14
|
+
root.addHandler(handler)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def format_payload(level, message, format="generic"):
|
|
5
|
+
timestamp = datetime.datetime.now(datetime.timezone.utc).isoformat()
|
|
6
|
+
if format == "generic":
|
|
7
|
+
return {
|
|
8
|
+
"source": "VersaLog",
|
|
9
|
+
"level": level,
|
|
10
|
+
"message": message,
|
|
11
|
+
"timestamp": timestamp,
|
|
12
|
+
}
|
|
13
|
+
if format == "discord":
|
|
14
|
+
return {"content": f"[{level}] {message}"}
|
|
15
|
+
if format == "slack":
|
|
16
|
+
return {"text": f"[{level}] {message}"}
|
|
17
|
+
raise ValueError("format must be 'generic', 'discord', or 'slack'")
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from .formatters import format_payload
|
|
2
|
+
from .sender import send_json
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
LEVELS = {
|
|
6
|
+
"DEBUG": 10,
|
|
7
|
+
"INFO": 20,
|
|
8
|
+
"WARNING": 30,
|
|
9
|
+
"ERROR": 40,
|
|
10
|
+
"CRITICAL": 50,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class WebhookHandler:
|
|
15
|
+
def __init__(self, url, level="ERROR", format="generic", timeout=3.0, headers=None):
|
|
16
|
+
if not isinstance(url, str) or not url.strip():
|
|
17
|
+
raise ValueError("url must be a non-empty string")
|
|
18
|
+
normalized_level = str(level).upper()
|
|
19
|
+
if normalized_level not in LEVELS:
|
|
20
|
+
raise ValueError(
|
|
21
|
+
"level must be one of: " + ", ".join(LEVELS.keys())
|
|
22
|
+
)
|
|
23
|
+
if format not in ("generic", "discord", "slack"):
|
|
24
|
+
raise ValueError("format must be 'generic', 'discord', or 'slack'")
|
|
25
|
+
if timeout <= 0:
|
|
26
|
+
raise ValueError("timeout must be greater than 0")
|
|
27
|
+
|
|
28
|
+
self.url = url
|
|
29
|
+
self.level = normalized_level
|
|
30
|
+
self.format = format
|
|
31
|
+
self.timeout = timeout
|
|
32
|
+
self.headers = dict(headers or {})
|
|
33
|
+
self.last_success = None
|
|
34
|
+
|
|
35
|
+
def should_handle(self, level):
|
|
36
|
+
return LEVELS.get(str(level).upper(), 0) >= LEVELS[self.level]
|
|
37
|
+
|
|
38
|
+
def emit(self, message, level):
|
|
39
|
+
payload = format_payload(str(level).upper(), str(message), self.format)
|
|
40
|
+
self.last_success = send_json(
|
|
41
|
+
self.url, payload, timeout=self.timeout, headers=self.headers
|
|
42
|
+
)
|
|
43
|
+
return self.last_success
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from urllib.error import HTTPError, URLError
|
|
3
|
+
from urllib.request import Request, urlopen
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def send_json(url, payload, timeout=3.0, headers=None):
|
|
7
|
+
request_headers = {"Content-Type": "application/json; charset=utf-8"}
|
|
8
|
+
if headers:
|
|
9
|
+
request_headers.update(headers)
|
|
10
|
+
data = json.dumps(payload, ensure_ascii=False).encode("utf-8")
|
|
11
|
+
request = Request(url, data=data, headers=request_headers, method="POST")
|
|
12
|
+
try:
|
|
13
|
+
with urlopen(request, timeout=timeout) as response:
|
|
14
|
+
return 200 <= response.status < 300
|
|
15
|
+
except (HTTPError, URLError, TimeoutError, OSError, ValueError):
|
|
16
|
+
return False
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: VersaLog
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Versatile logging library.
|
|
5
|
+
Home-page:
|
|
6
|
+
Author:
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Requires-Python: >=3.8, <3.14
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: plyer
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
1
30
|
## What is VersaLog.py?
|
|
2
31
|
|
|
3
32
|
[](https://badge.fury.io/py/VersaLog)
|
|
@@ -7,8 +36,69 @@
|
|
|
7
36
|
[](https://discord.gg/Ms2ejEES)
|
|
8
37
|
|
|
9
38
|
What is VersaLog.py?
|
|
10
|
-
|
|
11
|
-
|
|
39
|
+
|
|
40
|
+
VersaLog is a modern, powerful, and flexible logging library for Python.
|
|
41
|
+
It supports everything from simple usage to advanced, highly customizable configurations, making it suitable for a wide range of use cases.
|
|
42
|
+
|
|
43
|
+
## Feature
|
|
44
|
+
|
|
45
|
+
### Basic Logging
|
|
46
|
+
|
|
47
|
+
- Supports standard log levels:
|
|
48
|
+
- `INFO`, `ERROR`, `WARNING`, `DEBUG`, `CRITICAL`
|
|
49
|
+
- Colored output for better readability
|
|
50
|
+
- Symbol-based prefixes (e.g. `[+]`, `[-]`, `[!]`)
|
|
51
|
+
|
|
52
|
+
### Multiple Output Formats
|
|
53
|
+
|
|
54
|
+
**Easily switch between different log styles:**
|
|
55
|
+
|
|
56
|
+
- `simple` → `[+] message`
|
|
57
|
+
- `simple2` → `[TIME] [+] message`
|
|
58
|
+
- `detailed` → `[TIME][LEVEL] : message`
|
|
59
|
+
- `file` → `[FILE:LINE][LEVEL] message`
|
|
60
|
+
|
|
61
|
+
### Tag System
|
|
62
|
+
|
|
63
|
+
- Add custom tags to logs
|
|
64
|
+
- Supports multiple tags (e.g. `["API", "AUTH"]`)
|
|
65
|
+
- Optional default tags
|
|
66
|
+
|
|
67
|
+
### File & Line Tracking
|
|
68
|
+
|
|
69
|
+
- Display caller file name and line number
|
|
70
|
+
- Useful for debugging large projects
|
|
71
|
+
|
|
72
|
+
### Log File Saving
|
|
73
|
+
|
|
74
|
+
- Automatically save logs to files
|
|
75
|
+
- Output path: `./log/YYYY-MM-DD.log`
|
|
76
|
+
- Select which log levels to save
|
|
77
|
+
|
|
78
|
+
### Auto Cleanup
|
|
79
|
+
|
|
80
|
+
- Automatically deletes old log files (default: 7 days)
|
|
81
|
+
- Keeps your log directory clean
|
|
82
|
+
|
|
83
|
+
### Auto Cleanup
|
|
84
|
+
|
|
85
|
+
- Disable console output
|
|
86
|
+
- Useful for background services
|
|
87
|
+
|
|
88
|
+
### Exception Handling
|
|
89
|
+
|
|
90
|
+
- Automatically captures unhandled exceptions
|
|
91
|
+
- Logs them as `CRITICAL`
|
|
92
|
+
|
|
93
|
+
### Desktop Notifications
|
|
94
|
+
|
|
95
|
+
- Optional desktop alerts for errors and critical logs
|
|
96
|
+
- Uses `plyer.notification`
|
|
97
|
+
|
|
98
|
+
### Asynchronous Logging
|
|
99
|
+
|
|
100
|
+
- Non-blocking log processing using threads and queues
|
|
101
|
+
- Improves performance in high-load environments
|
|
12
102
|
|
|
13
103
|
## Support
|
|
14
104
|
|
|
@@ -54,12 +144,4 @@ logger = VersaLog(enum="detailed", tag="a", show_tag=True)
|
|
|
54
144
|
|
|
55
145
|
# two tag
|
|
56
146
|
logger = VersaLog(enum="detailed", tag=["a", "a"], show_tag=True)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Log save
|
|
60
|
-
|
|
61
|
-
````
|
|
62
|
-
|
|
63
|
-
[2025-08-06 04:10:36][INFO] : ok
|
|
64
|
-
|
|
65
|
-
```
|
|
147
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
VersaLog/__init__.py
|
|
5
|
+
VersaLog/core.py
|
|
6
|
+
VersaLog/handler.py
|
|
7
|
+
VersaLog.egg-info/PKG-INFO
|
|
8
|
+
VersaLog.egg-info/SOURCES.txt
|
|
9
|
+
VersaLog.egg-info/dependency_links.txt
|
|
10
|
+
VersaLog.egg-info/requires.txt
|
|
11
|
+
VersaLog.egg-info/top_level.txt
|
|
12
|
+
VersaLog/integrations/__init__.py
|
|
13
|
+
VersaLog/integrations/auto.py
|
|
14
|
+
VersaLog/integrations/django.py
|
|
15
|
+
VersaLog/integrations/fastapi.py
|
|
16
|
+
VersaLog/integrations/flask.py
|
|
17
|
+
VersaLog/integrations/generic.py
|
|
18
|
+
VersaLog/integrations/webhook/__init__.py
|
|
19
|
+
VersaLog/integrations/webhook/formatters.py
|
|
20
|
+
VersaLog/integrations/webhook/handler.py
|
|
21
|
+
VersaLog/integrations/webhook/sender.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
plyer
|
|
@@ -5,7 +5,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="VersaLog",
|
|
8
|
-
version="
|
|
8
|
+
version="3.0.0",
|
|
9
9
|
description="Versatile logging library.",
|
|
10
10
|
long_description=long_description,
|
|
11
11
|
long_description_content_type="text/markdown",
|
|
@@ -13,7 +13,9 @@ setup(
|
|
|
13
13
|
license="MIT",
|
|
14
14
|
packages=find_packages(include=["VersaLog", "VersaLog.*"]),
|
|
15
15
|
include_package_data=True,
|
|
16
|
-
install_requires=[
|
|
16
|
+
install_requires=[
|
|
17
|
+
"plyer"
|
|
18
|
+
],
|
|
17
19
|
python_requires=">=3.8, <3.14",
|
|
18
20
|
url="",
|
|
19
21
|
classifiers=[
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
from .core import VersaLog
|
|
2
|
-
from .handler import VersaLogHandler
|
|
3
|
-
from .integrations.fastapi import setup_fastapi_logging
|
|
4
|
-
|
|
5
|
-
__copyright__ = "Copyright 2025 by Kayu0514"
|
|
6
|
-
__version__ = "2.5.5"
|
|
7
|
-
__author__ = "Kayu0514"
|
|
8
|
-
__url__ = "https://github.com/kayu0514"
|
|
9
|
-
|
|
10
|
-
__all__ = ["VersaLog", "VersaLogHandler", "setup_fastapi_logging"]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
setup.py
|
|
4
|
-
VersaLog/__init__.py
|
|
5
|
-
VersaLog/core.py
|
|
6
|
-
VersaLog/handler.py
|
|
7
|
-
VersaLog.egg-info/PKG-INFO
|
|
8
|
-
VersaLog.egg-info/SOURCES.txt
|
|
9
|
-
VersaLog.egg-info/dependency_links.txt
|
|
10
|
-
VersaLog.egg-info/top_level.txt
|
|
11
|
-
VersaLog/integrations/__init__.py
|
|
12
|
-
VersaLog/integrations/fastapi.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|