From 0dbcfbe9a9e9c35b4d87b5a43daec0749462e6bb Mon Sep 17 00:00:00 2001 From: kaedeek Date: Wed, 15 Apr 2026 19:59:32 +0900 Subject: [PATCH 1/6] feat: add generic pyfile. --- VersaLog/integrations/generic.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 VersaLog/integrations/generic.py diff --git a/VersaLog/integrations/generic.py b/VersaLog/integrations/generic.py new file mode 100644 index 0000000..3ffffb8 --- /dev/null +++ b/VersaLog/integrations/generic.py @@ -0,0 +1,14 @@ +import logging +from ..handler import VersaLogHandler + + +def setup_logging(versalog): + handler = VersaLogHandler(versalog) + + root = logging.getLogger() + + for h in root.handlers[:]: + root.removeHandler(h) + + root.setLevel(logging.NOTSET) + root.addHandler(handler) \ No newline at end of file From aa1e7a3ef48e11bf6073c0643ba884110cf10b28 Mon Sep 17 00:00:00 2001 From: kaedeek Date: Wed, 15 Apr 2026 20:02:20 +0900 Subject: [PATCH 2/6] feat: add flask pyfile. --- VersaLog/integrations/flask.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 VersaLog/integrations/flask.py diff --git a/VersaLog/integrations/flask.py b/VersaLog/integrations/flask.py new file mode 100644 index 0000000..de54406 --- /dev/null +++ b/VersaLog/integrations/flask.py @@ -0,0 +1,8 @@ +from .generic import setup_logging + + +def setup_flask_logging(app, versalog): + setup_logging(versalog) + + app.logger.handlers.clear() + app.logger.propagate = True \ No newline at end of file From 038bd9e7f91216860afc063ebb259ec41658fa89 Mon Sep 17 00:00:00 2001 From: kaedeek Date: Wed, 15 Apr 2026 20:04:41 +0900 Subject: [PATCH 3/6] feat: add django pyfile. --- VersaLog/integrations/django.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 VersaLog/integrations/django.py diff --git a/VersaLog/integrations/django.py b/VersaLog/integrations/django.py new file mode 100644 index 0000000..8ae378c --- /dev/null +++ b/VersaLog/integrations/django.py @@ -0,0 +1,5 @@ +from .generic import setup_logging + + +def setup_django_logging(versalog): + setup_logging(versalog) \ No newline at end of file From ea5c5bdf08695646940f4e545c6d763dba2745c8 Mon Sep 17 00:00:00 2001 From: kaedeek Date: Wed, 15 Apr 2026 20:07:26 +0900 Subject: [PATCH 4/6] feat(Update): Update --- VersaLog/__init__.py | 6 ++++-- setup.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/VersaLog/__init__.py b/VersaLog/__init__.py index 9397fa4..e7b7504 100644 --- a/VersaLog/__init__.py +++ b/VersaLog/__init__.py @@ -1,10 +1,12 @@ from .core import VersaLog from .handler import VersaLogHandler from .integrations.fastapi import setup_fastapi_logging +from .integrations.flask import setup_flask_logging +from .integrations.django import setup_django_logging __copyright__ = "Copyright 2025 by Kayu0514" -__version__ = "2.5.6" +__version__ = "2.6.0" __author__ = "Kayu0514" __url__ = "https://github.com/kayu0514" -__all__ = ["VersaLog", "VersaLogHandler", "setup_fastapi_logging"] \ No newline at end of file +__all__ = ["VersaLog", "VersaLogHandler", "setup_fastapi_logging","setup_flask_logging", "setup_django_logging"] \ No newline at end of file diff --git a/setup.py b/setup.py index 766e7d1..2894b2d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="VersaLog", - version="2.5.6", + version="2.6.0", description="Versatile logging library.", long_description=long_description, long_description_content_type="text/markdown", From dbdf22b0275dddde691484db4132eb154e31166a Mon Sep 17 00:00:00 2001 From: kaedeek Date: Wed, 15 Apr 2026 20:12:22 +0900 Subject: [PATCH 5/6] feat: add auto pyfile. --- VersaLog/__init__.py | 3 ++- VersaLog/integrations/auto.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 VersaLog/integrations/auto.py diff --git a/VersaLog/__init__.py b/VersaLog/__init__.py index e7b7504..c965e2f 100644 --- a/VersaLog/__init__.py +++ b/VersaLog/__init__.py @@ -1,5 +1,6 @@ from .core import VersaLog from .handler import VersaLogHandler +from .integrations.auto import auto_setup from .integrations.fastapi import setup_fastapi_logging from .integrations.flask import setup_flask_logging from .integrations.django import setup_django_logging @@ -9,4 +10,4 @@ __author__ = "Kayu0514" __url__ = "https://github.com/kayu0514" -__all__ = ["VersaLog", "VersaLogHandler", "setup_fastapi_logging","setup_flask_logging", "setup_django_logging"] \ No newline at end of file +__all__ = ["VersaLog", "VersaLogHandler", "auto_setup", "setup_fastapi_logging","setup_flask_logging", "setup_django_logging"] \ No newline at end of file diff --git a/VersaLog/integrations/auto.py b/VersaLog/integrations/auto.py new file mode 100644 index 0000000..d343036 --- /dev/null +++ b/VersaLog/integrations/auto.py @@ -0,0 +1,32 @@ +import sys + +from .generic import setup_logging +from .fastapi import setup_fastapi_logging +from .flask import setup_flask_logging +from .django import setup_django_logging + + +def auto_setup(versalog): + """ + Automatically detects the runtime environment + and applies the appropriate logging configuration. + """ + + if "uvicorn" in sys.modules: + setup_fastapi_logging(versalog) + return "fastapi" + + if "gunicorn" in sys.modules: + setup_fastapi_logging(versalog) + return "gunicorn" + + if "flask" in sys.modules: + setup_flask_logging(None, versalog) + return "flask" + + if "django" in sys.modules: + setup_django_logging(versalog) + return "django" + + setup_logging(versalog) + return "generic" \ No newline at end of file From 6aad3a188edd545d3031f5d16e08b9a557327c8e Mon Sep 17 00:00:00 2001 From: kaedeek Date: Wed, 15 Apr 2026 20:15:49 +0900 Subject: [PATCH 6/6] feat'Update): Update README file --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a7b8ac..114bd75 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,9 @@ [![Discord](https://img.shields.io/badge/Discord-Support%20Server-7289DA?style=flat&logo=discord)](https://discord.gg/Ms2ejEES) What is VersaLog.py? -VersaLog is a powerful and flexible logging library for Python. -It supports everything from simple usage to advanced, highly customizable configurations to meet a wide range of needs. + +VersaLog is a modern, powerful, and flexible logging library for Python. +It supports everything from simple usage to advanced, highly customizable configurations, making it suitable for a wide range of use cases. ## Feature