Skip to content

Commit bf71d77

Browse files
authored
V4.0.3 (#5)
* V4.0.3 * V4.0.3 --------- Co-authored-by: ddc <ddc@users.noreply.github.com>
1 parent c3bcd59 commit bf71d77

File tree

2 files changed

+49
-46
lines changed

2 files changed

+49
-46
lines changed

.github/PULL_REQUEST_TEMPLATE.md renamed to .github/PULL_REQUEST_TEMPLATE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
- [ ] If code changes were made, then they have been tested.
77
- [ ] I have updated the documentation to reflect the changes.
88
- [ ] I have thought about how this code may affect other services.
9-
109
- [ ] This PR fixes an issue.
1110
- [ ] This PR adds something new (e.g. new method or parameters).
1211
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)

README.md

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ High-performance Python logging library with file rotation and optimized caching
2424
- [Timed Rotating Logger](#timed-rotating-logger)
2525
- [Context Manager Support](#context-manager-support)
2626
- [Advanced Factory Features](#advanced-factory-features)
27+
- [Environment Variables](#env-variables-optional--production)
2728
- [Memory Management](#memory-management)
29+
- [Flexible Configuration Options](#flexible-configuration-options)
2830
- [Migration Guide](#migration-guide)
2931
- [Performance Improvements](#performance-improvements)
30-
- [Environment Variables](#env-variables-optional)
3132
- [Development](#source-code)
33+
- [Run Tests and Get Coverage Report using Poe](#run-tests-and-get-coverage-report-using-poe)
34+
- [License](#license)
35+
- [Buy me a cup of coffee](#buy-me-a-cup-of-coffee)
3236

3337

3438

@@ -232,8 +236,9 @@ logger.warning("This is a warning example")
232236

233237

234238

235-
# Context Manager Support (slow but if you want immediate, deterministic cleanup for a specific scope)
239+
# Context Manager Support
236240

241+
Slow, but if you want immediate, deterministic cleanup for a specific scope.\
237242
All logger types support context managers for automatic resource cleanup and exception safety:
238243

239244
## Basic Usage
@@ -303,44 +308,6 @@ assert logger1 is logger2
303308
clear_logger_registry()
304309
```
305310

306-
## Flexible Configuration Options
307-
You can use either enums (for type safety) or strings (for simplicity):
308-
309-
```python
310-
from pythonLogs import LogLevel, RotateWhen, LoggerType
311-
312-
# Option 1: Type-safe enums (recommended)
313-
LogLevel.DEBUG # "DEBUG"
314-
LogLevel.INFO # "INFO"
315-
LogLevel.WARNING # "WARNING"
316-
LogLevel.ERROR # "ERROR"
317-
LogLevel.CRITICAL # "CRITICAL"
318-
319-
# Option 2: String values (case-insensitive)
320-
"debug" # Same as LogLevel.DEBUG
321-
"info" # Same as LogLevel.INFO
322-
"warning" # Same as LogLevel.WARNING
323-
"warn" # Same as LogLevel.WARN (alias)
324-
"error" # Same as LogLevel.ERROR
325-
"critical" # Same as LogLevel.CRITICAL
326-
"crit" # Same as LogLevel.CRIT (alias)
327-
# Also supports: "DEBUG", "Info", "Warning", etc.
328-
329-
# RotateWhen values
330-
RotateWhen.MIDNIGHT # "midnight"
331-
RotateWhen.HOURLY # "H"
332-
RotateWhen.DAILY # "D"
333-
RotateWhen.MONDAY # "W0"
334-
# ... through SUNDAY # "W6"
335-
# String equivalents: "midnight", "H", "D", "W0"-"W6"
336-
337-
# LoggerType values
338-
LoggerType.BASIC # "basic"
339-
LoggerType.SIZE_ROTATING # "size_rotating"
340-
LoggerType.TIMED_ROTATING # "timed_rotating"
341-
# String equivalents: "basic", "size_rotating", "timed_rotating"
342-
```
343-
344311
## Production Setup Example
345312
```python
346313
from pythonLogs import size_rotating_logger, timed_rotating_logger, LogLevel, RotateWhen
@@ -385,9 +352,9 @@ audit_logger.info("User admin logged in")
385352
```
386353

387354
## Env Variables (Optional | Production)
388-
The .env variables file can be used by leaving all options blank when calling the function
389-
If not specified inside the .env file, it will use the dafault value
390-
This is a good approach for production environments, since options can be changed easily
355+
The .env variables file can be used by leaving all options blank when calling the function.\
356+
If not specified inside the .env file, it will use the dafault value.\
357+
This is a good approach for production environments, since options can be changed easily.
391358
```python
392359
from pythonLogs import timed_rotating_logger
393360
log = timed_rotating_logger()
@@ -417,8 +384,6 @@ LOG_ROTATE_FILE_SUFIX="%Y%m%d"
417384
```
418385

419386

420-
421-
422387
# Memory Management
423388

424389
The library includes comprehensive memory management features to prevent memory leaks and optimize resource usage:
@@ -515,6 +480,45 @@ clear_logger_registry()
515480
```
516481

517482

483+
# Flexible Configuration Options
484+
You can use either enums (for type safety) or strings (for simplicity):
485+
486+
```python
487+
from pythonLogs import LogLevel, RotateWhen, LoggerType
488+
489+
# Option 1: Type-safe enums (recommended)
490+
LogLevel.DEBUG # "DEBUG"
491+
LogLevel.INFO # "INFO"
492+
LogLevel.WARNING # "WARNING"
493+
LogLevel.ERROR # "ERROR"
494+
LogLevel.CRITICAL # "CRITICAL"
495+
496+
# Option 2: String values (case-insensitive)
497+
"debug" # Same as LogLevel.DEBUG
498+
"info" # Same as LogLevel.INFO
499+
"warning" # Same as LogLevel.WARNING
500+
"warn" # Same as LogLevel.WARN (alias)
501+
"error" # Same as LogLevel.ERROR
502+
"critical" # Same as LogLevel.CRITICAL
503+
"crit" # Same as LogLevel.CRIT (alias)
504+
# Also supports: "DEBUG", "Info", "Warning", etc.
505+
506+
# RotateWhen values
507+
RotateWhen.MIDNIGHT # "midnight"
508+
RotateWhen.HOURLY # "H"
509+
RotateWhen.DAILY # "D"
510+
RotateWhen.MONDAY # "W0"
511+
# ... through SUNDAY # "W6"
512+
# String equivalents: "midnight", "H", "D", "W0"-"W6"
513+
514+
# LoggerType values
515+
LoggerType.BASIC # "basic"
516+
LoggerType.SIZE_ROTATING # "size_rotating"
517+
LoggerType.TIMED_ROTATING # "timed_rotating"
518+
# String equivalents: "basic", "size_rotating", "timed_rotating"
519+
```
520+
521+
518522
# Migration Guide
519523

520524
## Upgrading from Legacy to Factory Pattern

0 commit comments

Comments
 (0)