logging-ext2 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl
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.
- logging_ext2/__about__.py +1 -1
- logging_ext2/handlers.py +15 -7
- {logging_ext2-0.2.2.dist-info → logging_ext2-0.2.3.dist-info}/METADATA +2 -1
- logging_ext2-0.2.3.dist-info/RECORD +8 -0
- logging_ext2-0.2.2.dist-info/RECORD +0 -8
- {logging_ext2-0.2.2.dist-info → logging_ext2-0.2.3.dist-info}/WHEEL +0 -0
- {logging_ext2-0.2.2.dist-info → logging_ext2-0.2.3.dist-info}/licenses/LICENSE +0 -0
logging_ext2/__about__.py
CHANGED
logging_ext2/handlers.py
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
|
6
6
|
import datetime
|
7
7
|
import subprocess
|
8
|
+
import time
|
9
|
+
|
10
|
+
from filelock import FileLock
|
8
11
|
|
9
12
|
from logging import Handler, NOTSET
|
10
13
|
from pathlib import Path
|
@@ -75,11 +78,16 @@ class TimedRotatingFileHandler(Handler):
|
|
75
78
|
continue
|
76
79
|
if to_gzip_path.suffix == ".gz":
|
77
80
|
continue
|
78
|
-
self.base_dir.joinpath(self.filename)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
lock_path = self.base_dir.joinpath(self.filename)
|
82
|
+
lock_path.touch()
|
83
|
+
with FileLock(lock_path, timeout=10):
|
84
|
+
target_file = to_gzip_path.parent.joinpath(
|
85
|
+
to_gzip_path.name + ".gz"
|
86
|
+
)
|
87
|
+
if target_file.exists():
|
88
|
+
target_file.rename(target_file.parent.joinpath(
|
89
|
+
target_file.stem + "_" + str(time.time())
|
90
|
+
).with_suffix(".gz"))
|
91
|
+
cmds = ["gzip", to_gzip_path]
|
92
|
+
subprocess.run(cmds)
|
85
93
|
self.stream = self.init_stream()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: logging-ext2
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.3
|
4
4
|
Summary: extend python logging library
|
5
5
|
Project-URL: Documentation, https://github.com/ramwin/logging-ext#readme
|
6
6
|
Project-URL: Issues, https://github.com/ramwin/logging-ext/issues
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
18
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
19
19
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
20
20
|
Requires-Python: >=3.8
|
21
|
+
Requires-Dist: filelock
|
21
22
|
Description-Content-Type: text/markdown
|
22
23
|
|
23
24
|
# logging-ext2
|
@@ -0,0 +1,8 @@
|
|
1
|
+
logging_ext2/__about__.py,sha256=2TvUlJ3rS9OmT2VeHP6SC0RFt1TGcxGLTqiDuXb_omA,121
|
2
|
+
logging_ext2/__init__.py,sha256=BA6rgdmh3z2v01cbHU1FRMsBIRV5vQjh2w9FzG2F2GY,99
|
3
|
+
logging_ext2/handlers.py,sha256=Rv6ygtxuDkM7shucJPMBjmTQhTFNzGwUM8ZrVQXR_YY,3290
|
4
|
+
logging_ext2/types.py,sha256=cLjODjTgxrZEXUZzOkrFm3s6bUG3Itc_fS7KJ-MSWC8,237
|
5
|
+
logging_ext2-0.2.3.dist-info/METADATA,sha256=XUsJSKKkMlyo6rZ4ayMEg9CkoiOPPEHkr-CYsh_aUls,1453
|
6
|
+
logging_ext2-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
7
|
+
logging_ext2-0.2.3.dist-info/licenses/LICENSE,sha256=RckqF9bdq7oO9RrL4iZYuXNhkIcXexbXNF2ToiaJymU,1067
|
8
|
+
logging_ext2-0.2.3.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
logging_ext2/__about__.py,sha256=CwnIpwy4dY5_pEu6b684l8Sx6zWLEmy0PSCcBVT27Zg,121
|
2
|
-
logging_ext2/__init__.py,sha256=BA6rgdmh3z2v01cbHU1FRMsBIRV5vQjh2w9FzG2F2GY,99
|
3
|
-
logging_ext2/handlers.py,sha256=_kD4jtd9otv5Me4Zx099Glh2wZoq1gJTGt7HiQAE7y0,2967
|
4
|
-
logging_ext2/types.py,sha256=cLjODjTgxrZEXUZzOkrFm3s6bUG3Itc_fS7KJ-MSWC8,237
|
5
|
-
logging_ext2-0.2.2.dist-info/METADATA,sha256=T6ZjAFvVK4N8PnNACvYnAIm9RabCziS4ZBIj7IEmUwc,1429
|
6
|
-
logging_ext2-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
7
|
-
logging_ext2-0.2.2.dist-info/licenses/LICENSE,sha256=RckqF9bdq7oO9RrL4iZYuXNhkIcXexbXNF2ToiaJymU,1067
|
8
|
-
logging_ext2-0.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|