Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,10 @@
- [ ] Documentation
- [ ] CI/CD or build configuration
- [ ] Dependencies update
- [ ] Other

## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] All existing tests pass
- [ ] Manual testing performed

## Checklist
- [ ] Code follows the project's style and conventions
- [ ] Documentation updated (if applicable)
- [ ] No new warnings or linter errors introduced
- [ ] I have considered how this change may affect other services

## Reviewer
- [ ] I understand that by approving this PR, I share responsibility for these changes
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.11', '3.14']
python-version: ['3.12', '3.14']
defaults:
run:
working-directory: ${{ github.workspace }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,4 @@ cython_debug/
# Custom
/junit.xml
*.prof
/requirements.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024-present ddc
Copyright (C) 2024 DDC Softwares

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
62 changes: 32 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<h1 align="center">
<img src="https://raw.githubusercontent.com/ddc/pythonLogs/main/assets/pythonLogs-icon.svg" alt="pythonLogs" width="150">
<img src="https://raw.githubusercontent.com/ddc/pythonlogs/main/assets/pythonlogs-icon.svg" alt="pythonlogs" width="150">
<br>
pythonLogs
pythonlogs
</h1>

<p align="center">
<a href="https://www.paypal.com/ncp/payment/6G9Z78QHUD4RJ"><img src="https://img.shields.io/badge/Donate-PayPal-brightgreen.svg?style=plastic" alt="Donate"/></a>
<a href="https://github.com/sponsors/ddc"><img src="https://img.shields.io/static/v1?style=plastic&label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=ff69b4" alt="Sponsor"/></a>
<br>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=plastic" alt="License: MIT"/></a>
<a href="https://pepy.tech/projects/pythonLogs"><img src="https://static.pepy.tech/badge/pythonLogs?style=plastic" alt="PyPI Downloads"/></a>
<a href="https://pypi.python.org/pypi/pythonLogs"><img src="https://img.shields.io/pypi/v/pythonLogs.svg?style=plastic&logo=python&cacheSeconds=3600" alt="PyPi"/></a>
<a href="https://ko-fi.com/ddc"><img src="https://img.shields.io/badge/Ko--fi-ddc-FF5E5B?style=plastic&logo=kofi&logoColor=white&color=brightgreen" alt="Ko-fi"/></a>
<a href="https://www.paypal.com/ncp/payment/6G9Z78QHUD4RJ"><img src="https://img.shields.io/badge/Donate-PayPal-brightgreen.svg?style=plastic&logo=paypal&logoColor=white" alt="Donate"/></a>
<br>
<a href="https://www.python.org/downloads"><img src="https://img.shields.io/pypi/pyversions/pythonLogs.svg?style=plastic&logo=python&cacheSeconds=3600" alt="Python"/></a>
<a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json?style=plastic" alt="uv"/></a>
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json?style=plastic" alt="Ruff"/></a>
<a href="https://pypi.python.org/pypi/pythonlogs"><img src="https://img.shields.io/pypi/v/pythonlogs.svg?style=plastic&logo=python&cacheSeconds=3600" alt="PyPi"/></a>
<a href="https://pepy.tech/projects/pythonlogs"><img src="https://img.shields.io/pepy/dt/pythonlogs?style=plastic&logo=pypi&logoColor=3776AB" alt="PyPI Downloads"/></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=plastic&logo=creativecommons&logoColor=white" alt="License: MIT"/></a>
<br>
<a href="https://github.com/ddc/pythonLogs/issues"><img src="https://img.shields.io/github/issues/ddc/pythonLogs?style=plastic" alt="issues"/></a>
<a href="https://codecov.io/gh/ddc/pythonLogs"><img src="https://codecov.io/gh/ddc/pythonLogs/graph/badge.svg?token=XWB53034GI&style=plastic" alt="codecov"/></a>
<a href="https://sonarcloud.io/dashboard?id=ddc_pythonLogs"><img src="https://sonarcloud.io/api/project_badges/measure?project=ddc_pythonLogs&metric=alert_status&style=plastic" alt="Quality Gate Status"/></a>
<a href="https://github.com/ddc/pythonLogs/actions/workflows/workflow.yml"><img src="https://github.com/ddc/pythonLogs/actions/workflows/workflow.yml/badge.svg?style=plastic" alt="CI/CD Pipeline"/></a>
<a href="https://actions-badge.atrox.dev/ddc/pythonLogs/goto?ref=main"><img src="https://img.shields.io/endpoint.svg?url=https%3A//actions-badge.atrox.dev/ddc/pythonLogs/badge?ref=main&label=build&logo=none&style=plastic" alt="Build Status"/></a>
<a href="https://www.python.org/downloads"><img src="https://img.shields.io/pypi/pyversions/pythonlogs.svg?style=plastic&logo=python&cacheSeconds=3600" alt="Python"/></a>
<a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json&style=plastic" alt="uv"/></a>
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=plastic" alt="Ruff"/></a>
<br>
<a href="https://github.com/ddc/pythonlogs/issues"><img src="https://img.shields.io/github/issues/ddc/pythonlogs?style=plastic&logo=github&logoColor=white" alt="issues"/></a>
<a href="https://codecov.io/gh/ddc/pythonlogs"><img src="https://img.shields.io/codecov/c/github/ddc/pythonlogs?token=XWB53034GI&style=plastic&logo=codecov" alt="codecov"/></a>
<a href="https://sonarcloud.io/dashboard?id=ddc_pythonlogs"><img src="https://img.shields.io/sonar/quality_gate/ddc_pythonlogs?server=https%3A%2F%2Fsonarcloud.io&style=plastic&logo=sonarqubecloud&logoColor=white" alt="Quality Gate Status"/></a>
<a href="https://github.com/ddc/pythonlogs/actions/workflows/workflow.yml"><img src="https://img.shields.io/github/actions/workflow/status/ddc/pythonlogs/workflow.yml?style=plastic&logo=github&logoColor=white&label=CI%2FCD%20Pipeline" alt="CI/CD Pipeline"/></a>
<a href="https://actions-badge.atrox.dev/ddc/pythonlogs/goto?ref=main"><img src="https://img.shields.io/endpoint.svg?url=https%3A//actions-badge.atrox.dev/ddc/pythonlogs/badge?ref=main&label=build&logo=github&style=plastic" alt="Build Status"/></a>
</p>

<p align="center">High-performance Python logging library with file rotation and optimized caching for better performance</p>
Expand Down Expand Up @@ -67,7 +69,7 @@
# Installation

```shell
pip install pythonLogs
pip install pythonlogs
```


Expand All @@ -83,7 +85,7 @@ Console-only logging without file output. Perfect for development and simple app
### Usage

```python
from pythonLogs import BasicLog
from pythonlogs import BasicLog

logger = BasicLog(
name="my_app",
Expand Down Expand Up @@ -113,7 +115,7 @@ File-based logging with automatic rotation when files reach a specified size. Ro
### Usage

```python
from pythonLogs import SizeRotatingLog
from pythonlogs import SizeRotatingLog

logger = SizeRotatingLog(
name="my_app",
Expand Down Expand Up @@ -149,7 +151,7 @@ File-based logging with automatic rotation based on time intervals. Rotated file
### Usage

```python
from pythonLogs import TimedRotatingLog
from pythonlogs import TimedRotatingLog

logger = TimedRotatingLog(
name="my_app",
Expand Down Expand Up @@ -180,10 +182,10 @@ All logger types support context managers for automatic resource cleanup and exc
## Usage Examples

```python
from pythonLogs import LogLevel
from pythonLogs.basic_log import BasicLog
from pythonLogs.size_rotating import SizeRotatingLog
from pythonLogs.timed_rotating import TimedRotatingLog
from pythonlogs import LogLevel
from pythonlogs.basic_log import BasicLog
from pythonlogs.size_rotating import SizeRotatingLog
from pythonlogs.timed_rotating import TimedRotatingLog

# Automatic cleanup with context managers
with BasicLog(name="app", level=LogLevel.INFO) as logger:
Expand All @@ -210,7 +212,7 @@ except ValueError:
# Using With Multiple Log Levels and Files

```python
from pythonLogs import SizeRotatingLog, TimedRotatingLog, LogLevel, RotateWhen
from pythonlogs import SizeRotatingLog, TimedRotatingLog, LogLevel, RotateWhen

# Application logger
app_logger = SizeRotatingLog(
Expand Down Expand Up @@ -260,7 +262,7 @@ The .env variables file can be used by leaving all options blank when calling th
If not specified inside the .env file, it will use the default value.\
This is a good approach for production environments, since options can be changed easily.
```python
from pythonLogs import TimedRotatingLog
from pythonlogs import TimedRotatingLog
log = TimedRotatingLog()
```

Expand Down Expand Up @@ -292,7 +294,7 @@ LOG_ROTATE_FILE_SUFIX="%Y%m%d"
Use `get_log_settings()` to inspect current configuration and `clear_settings_cache()` to reload configuration from environment variables:

```python
from pythonLogs import get_log_settings, clear_settings_cache
from pythonlogs import get_log_settings, clear_settings_cache

# Inspect current settings
settings = get_log_settings()
Expand All @@ -316,7 +318,7 @@ clear_settings_cache(reload_env=False)
You can use either enums (for type safety) or strings (for simplicity):

```python
from pythonLogs import LogLevel, RotateWhen
from pythonlogs import LogLevel, RotateWhen

# Option 1: Type-safe enums (recommended)
LogLevel.DEBUG # "DEBUG"
Expand Down Expand Up @@ -397,8 +399,8 @@ Released under the [MIT License](LICENSE)

# Support

If you find this project helpful, consider supporting development:
If you find this project helpful, consider supporting development.

- [GitHub Sponsor](https://github.com/sponsors/ddc)
- [ko-fi](https://ko-fi.com/ddcsta)
- [PayPal](https://www.paypal.com/ncp/payment/6G9Z78QHUD4RJ)
<a href='https://github.com/sponsors/ddc' target='_blank'><img height='24' style='border:0px;height:24px;' src='https://img.shields.io/badge/Sponsor-❤-ea4aaa?style=plastic&logo=github&logoColor=white' border='0' alt='Sponsor on GitHub' /></a>
<a href='https://ko-fi.com/ddc' target='_blank'><img height='30' style='border:0px;height:30px;' src='https://storage.ko-fi.com/cdn/kofi2.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
<a href='https://www.paypal.com/ncp/payment/6G9Z78QHUD4RJ' target='_blank'><img height='30' style='border:0px;height:30px;' src='https://www.paypalobjects.com/digitalassets/c/website/marketing/apac/C2/logos-buttons/optimize/44_Yellow_PayPal_Pill_Button.png' border='0' alt='Donate via PayPal' /></a>
31 changes: 16 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ build-backend = "hatchling.build"
allow-direct-references = true

[tool.hatch.build]
include = ["pythonLogs/**/*"]
include = ["pythonlogs/**/*"]

[tool.hatch.build.targets.wheel]
packages = ["pythonLogs"]
packages = ["pythonlogs"]

[project]
name = "pythonLogs"
version = "6.0.3"
name = "pythonlogs"
version = "7.0.0"
description = "High-performance Python logging library with file rotation and optimized caching for better performance"
urls.Repository = "https://github.com/ddc/pythonLogs"
urls.Homepage = "https://pypi.org/project/pythonLogs"
urls.Repository = "https://github.com/ddc/pythonlogs"
urls.Homepage = "https://pypi.org/project/pythonlogs"
license = {text = "MIT"}
readme = "README.md"
authors = [
Expand All @@ -28,14 +28,13 @@ maintainers = [
keywords = [
"python", "python3", "python-3",
"log", "logging", "logger",
"logutils", "log-utils", "pythonLogs"
"logutils", "log-utils", "pythonlogs"
]
classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
Expand All @@ -44,7 +43,7 @@ classifiers = [
"Intended Audience :: Developers",
"Natural Language :: English",
]
requires-python = ">=3.11"
requires-python = ">=3.12"
dependencies = [
"pydantic-settings>=2.11.0",
]
Expand All @@ -53,12 +52,14 @@ dependencies = [
dev = [
"psutil>=7.2.2",
"pytest-cov>=7.0.0",
"poethepoet>=0.42.0",
"ruff>=0.15.2",
"poethepoet>=0.42.1",
"ruff>=0.15.7",
]

[tool.poe.tasks]
linter.shell = "uv run ruff check --fix . && uv run ruff format ."
snyk-export.shell = "rm -f requirements.txt && uv export --no-hashes --no-annotate --format requirements-txt > requirements.txt && uvx pre-commit run --all-files || uvx pre-commit run --all-files"
snyk.sequence = ["snyk-export", { shell = "uv pip install pip && snyk test --file=requirements.txt && snyk code test; uv pip uninstall pip" }]
profile = "uv run python -m cProfile -o cprofile_unit.prof -m pytest --no-cov"
tests.sequence = ["linter", {shell = "uv run pytest"}]
updatedev.sequence = ["linter", {shell = "uv lock --upgrade && uv sync --all-extras --group dev"}]
Expand Down Expand Up @@ -96,18 +97,18 @@ exclude_lines = [

[tool.ruff]
line-length = 120
target-version = "py311"
target-version = "py312"

[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "C4", "UP"]
select = ["E", "W", "F", "I", "B", "C4", "UP", "S", "SLF"]
ignore = ["E501", "E402", "UP046", "UP047"]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**/*.py" = ["S101", "S105", "S106", "S311", "SLF001", "F841"]
"tests/**/*.py" = ["S101", "S103", "S105", "S106", "S110", "S311", "S603", "S607", "SLF001", "F841"]

[tool.ruff.lint.isort]
known-first-party = ["pythonLogs"]
known-first-party = ["pythonlogs"]
force-sort-within-sections = false
from-first = false
no-sections = true
2 changes: 1 addition & 1 deletion pythonLogs/.env.example → pythonlogs/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pythonLogs Environment Configuration
# pythonlogs Environment Configuration
# Copy this file to .env and modify values as needed

# Main Settings
Expand Down
8 changes: 4 additions & 4 deletions pythonLogs/__init__.py → pythonlogs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
from importlib.metadata import version
from pythonLogs.core.constants import LogLevel, RotateWhen
from pythonLogs.core.factory import BasicLog, SizeRotatingLog, TimedRotatingLog
from pythonLogs.core.settings import clear_settings_cache, get_log_settings
from pythonlogs.core.constants import LogLevel, RotateWhen
from pythonlogs.core.factory import BasicLog, SizeRotatingLog, TimedRotatingLog
from pythonlogs.core.settings import clear_settings_cache, get_log_settings

__all__ = (
"BasicLog",
Expand All @@ -14,7 +14,7 @@
"get_log_settings",
)

__title__ = "pythonLogs"
__title__ = "pythonlogs"
__author__ = "Daniel Costa"
__email__ = "daniel@ddcsoftwares.com"
__license__ = "MIT"
Expand Down
8 changes: 4 additions & 4 deletions pythonLogs/basic_log.py → pythonlogs/basic_log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
from pythonLogs.core.log_utils import cleanup_logger_handlers, get_format, get_level, get_timezone_function
from pythonLogs.core.memory_utils import register_logger_weakref
from pythonLogs.core.settings import get_log_settings
from pythonLogs.core.thread_safety import auto_thread_safe
from pythonlogs.core.log_utils import cleanup_logger_handlers, get_format, get_level, get_timezone_function
from pythonlogs.core.memory_utils import register_logger_weakref
from pythonlogs.core.settings import get_log_settings
from pythonlogs.core.thread_safety import auto_thread_safe


@auto_thread_safe(["init"])
Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading