From c3cd6a83016fb1626ba425bf5e2f01f3ab89d40f Mon Sep 17 00:00:00 2001 From: ddc Date: Sun, 20 Jul 2025 12:08:02 -0300 Subject: [PATCH 1/2] V4.0.3 --- README.md | 94 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index cc3004e..e5c5c0c 100755 --- a/README.md +++ b/README.md @@ -24,11 +24,15 @@ High-performance Python logging library with file rotation and optimized caching - [Timed Rotating Logger](#timed-rotating-logger) - [Context Manager Support](#context-manager-support) - [Advanced Factory Features](#advanced-factory-features) +- [Environment Variables](#env-variables-optional--production) - [Memory Management](#memory-management) +- [Flexible Configuration Options](#flexible-configuration-options) - [Migration Guide](#migration-guide) - [Performance Improvements](#performance-improvements) -- [Environment Variables](#env-variables-optional) - [Development](#source-code) +- [Run Tests and Get Coverage Report using Poe](#run-tests-and-get-coverage-report-using-poe) +- [License](#license) +- [Buy me a cup of coffee](#buy-me-a-cup-of-coffee) @@ -232,8 +236,9 @@ logger.warning("This is a warning example") -# Context Manager Support (slow but if you want immediate, deterministic cleanup for a specific scope) +# Context Manager Support +Slow, but if you want immediate, deterministic cleanup for a specific scope.\ All logger types support context managers for automatic resource cleanup and exception safety: ## Basic Usage @@ -303,44 +308,6 @@ assert logger1 is logger2 clear_logger_registry() ``` -## Flexible Configuration Options -You can use either enums (for type safety) or strings (for simplicity): - -```python -from pythonLogs import LogLevel, RotateWhen, LoggerType - -# Option 1: Type-safe enums (recommended) -LogLevel.DEBUG # "DEBUG" -LogLevel.INFO # "INFO" -LogLevel.WARNING # "WARNING" -LogLevel.ERROR # "ERROR" -LogLevel.CRITICAL # "CRITICAL" - -# Option 2: String values (case-insensitive) -"debug" # Same as LogLevel.DEBUG -"info" # Same as LogLevel.INFO -"warning" # Same as LogLevel.WARNING -"warn" # Same as LogLevel.WARN (alias) -"error" # Same as LogLevel.ERROR -"critical" # Same as LogLevel.CRITICAL -"crit" # Same as LogLevel.CRIT (alias) -# Also supports: "DEBUG", "Info", "Warning", etc. - -# RotateWhen values -RotateWhen.MIDNIGHT # "midnight" -RotateWhen.HOURLY # "H" -RotateWhen.DAILY # "D" -RotateWhen.MONDAY # "W0" -# ... through SUNDAY # "W6" -# String equivalents: "midnight", "H", "D", "W0"-"W6" - -# LoggerType values -LoggerType.BASIC # "basic" -LoggerType.SIZE_ROTATING # "size_rotating" -LoggerType.TIMED_ROTATING # "timed_rotating" -# String equivalents: "basic", "size_rotating", "timed_rotating" -``` - ## Production Setup Example ```python from pythonLogs import size_rotating_logger, timed_rotating_logger, LogLevel, RotateWhen @@ -385,9 +352,9 @@ audit_logger.info("User admin logged in") ``` ## Env Variables (Optional | Production) -The .env variables file can be used by leaving all options blank when calling the function -If not specified inside the .env file, it will use the dafault value -This is a good approach for production environments, since options can be changed easily +The .env variables file can be used by leaving all options blank when calling the function.\ +If not specified inside the .env file, it will use the dafault value.\ +This is a good approach for production environments, since options can be changed easily. ```python from pythonLogs import timed_rotating_logger log = timed_rotating_logger() @@ -417,8 +384,6 @@ LOG_ROTATE_FILE_SUFIX="%Y%m%d" ``` - - # Memory Management The library includes comprehensive memory management features to prevent memory leaks and optimize resource usage: @@ -515,6 +480,45 @@ clear_logger_registry() ``` +# Flexible Configuration Options +You can use either enums (for type safety) or strings (for simplicity): + +```python +from pythonLogs import LogLevel, RotateWhen, LoggerType + +# Option 1: Type-safe enums (recommended) +LogLevel.DEBUG # "DEBUG" +LogLevel.INFO # "INFO" +LogLevel.WARNING # "WARNING" +LogLevel.ERROR # "ERROR" +LogLevel.CRITICAL # "CRITICAL" + +# Option 2: String values (case-insensitive) +"debug" # Same as LogLevel.DEBUG +"info" # Same as LogLevel.INFO +"warning" # Same as LogLevel.WARNING +"warn" # Same as LogLevel.WARN (alias) +"error" # Same as LogLevel.ERROR +"critical" # Same as LogLevel.CRITICAL +"crit" # Same as LogLevel.CRIT (alias) +# Also supports: "DEBUG", "Info", "Warning", etc. + +# RotateWhen values +RotateWhen.MIDNIGHT # "midnight" +RotateWhen.HOURLY # "H" +RotateWhen.DAILY # "D" +RotateWhen.MONDAY # "W0" +# ... through SUNDAY # "W6" +# String equivalents: "midnight", "H", "D", "W0"-"W6" + +# LoggerType values +LoggerType.BASIC # "basic" +LoggerType.SIZE_ROTATING # "size_rotating" +LoggerType.TIMED_ROTATING # "timed_rotating" +# String equivalents: "basic", "size_rotating", "timed_rotating" +``` + + # Migration Guide ## Upgrading from Legacy to Factory Pattern From f8f9e9aec552dca0e933bc4b2a3b1741f40676c5 Mon Sep 17 00:00:00 2001 From: ddc Date: Sun, 20 Jul 2025 12:09:30 -0300 Subject: [PATCH 2/2] V4.0.3 --- .github/{PULL_REQUEST_TEMPLATE.md => PULL_REQUEST_TEMPLATE} | 1 - 1 file changed, 1 deletion(-) rename .github/{PULL_REQUEST_TEMPLATE.md => PULL_REQUEST_TEMPLATE} (99%) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE similarity index 99% rename from .github/PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE index 88be1e1..96e3af1 100755 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE @@ -6,7 +6,6 @@ - [ ] If code changes were made, then they have been tested. - [ ] I have updated the documentation to reflect the changes. - [ ] I have thought about how this code may affect other services. - - [ ] This PR fixes an issue. - [ ] This PR adds something new (e.g. new method or parameters). - [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)