logger-36 2025.7__tar.gz → 2025.8__tar.gz
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.
- {logger_36-2025.7 → logger_36-2025.8}/PKG-INFO +1 -1
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/api/storage.py +1 -1
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/handler/console_rich.py +9 -0
- logger_36-2025.7/package/logger_36/task/storage.py → logger_36-2025.8/package/logger_36/extension/html_.py +20 -77
- logger_36-2025.8/package/logger_36/task/storage.py +97 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/type/logger.py +13 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/version.py +1 -1
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36.egg-info/PKG-INFO +1 -1
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36.egg-info/SOURCES.txt +1 -0
- {logger_36-2025.7 → logger_36-2025.8}/MANIFEST.in +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/README-COPYRIGHT-utf8.txt +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/README-LICENCE-utf8.txt +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/README.rst +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/documentation/wiki/description.asciidoc +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/__init__.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/api/logger.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/config/console_rich.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/config/optional.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/handler/console.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/handler/file.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/handler/generic.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/logger/chronos.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/logger/gpu.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/logger/memory.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/catalog/logger/system.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/config/issue.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/config/memory.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/config/message.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/config/system.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/error.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/generic.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/handler.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/issue.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/logger.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/memory.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/message.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/path.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/record.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/constant/system.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/content.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/exception.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/gpu.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/handler.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/instance/logger.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/instance/loggers.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/memory.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/storage.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/system.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/task/format/memory.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/task/format/message.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/task/format/rule.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/task/inspection.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/task/measure/chronos.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/task/measure/memory.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/time.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/type/handler.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/type/issue.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36/type/loggers.py +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36.egg-info/dependency_links.txt +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/package/logger_36.egg-info/top_level.txt +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/pyproject.toml +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/setup.cfg +0 -0
- {logger_36-2025.7 → logger_36-2025.8}/setup.py +0 -0
@@ -74,6 +74,15 @@ class console_rich_handler_t(l.Handler):
|
|
74
74
|
|
75
75
|
rich_kwargs: d.InitVar[dict[str, h.Any] | None] = None
|
76
76
|
|
77
|
+
@property
|
78
|
+
def past_logs_as_HTML(self) -> str | None:
|
79
|
+
""""""
|
80
|
+
console = self.console
|
81
|
+
if console.record:
|
82
|
+
return console.export_html()
|
83
|
+
|
84
|
+
return None
|
85
|
+
|
77
86
|
def __post_init__(
|
78
87
|
self,
|
79
88
|
name: str | None,
|
@@ -5,35 +5,40 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as l
|
9
8
|
import re as r
|
10
|
-
from html.parser import HTMLParser as
|
11
|
-
from io import IOBase as io_base_t
|
12
|
-
from pathlib import Path as path_t
|
13
|
-
|
14
|
-
from logger_36.catalog.config.optional import RICH_IS_AVAILABLE
|
15
|
-
from logger_36.instance.logger import L
|
16
|
-
|
17
|
-
if RICH_IS_AVAILABLE:
|
18
|
-
from rich.console import Console as console_t # noqa
|
19
|
-
else:
|
20
|
-
console_t = None
|
21
|
-
|
9
|
+
from html.parser import HTMLParser as base_t
|
22
10
|
|
23
11
|
_BODY_END_PATTERN = r"</[bB][oO][dD][yY]>(.|\n)*$"
|
24
12
|
|
25
13
|
|
26
14
|
@d.dataclass(slots=True, repr=False, eq=False)
|
27
|
-
class
|
15
|
+
class html_content_t(base_t):
|
28
16
|
source: str = ""
|
29
17
|
inside_body: bool = d.field(init=False, default=False)
|
30
18
|
body_position_start: tuple[int, int] = d.field(init=False, default=(-1, -1))
|
31
19
|
body_position_end: tuple[int, int] = d.field(init=False, default=(-1, -1))
|
32
20
|
pieces: list[str] = d.field(init=False, default_factory=list)
|
33
21
|
|
22
|
+
@property
|
23
|
+
def body(self) -> str:
|
24
|
+
""""""
|
25
|
+
output = self.source.splitlines()
|
26
|
+
output = "\n".join(
|
27
|
+
output[self.body_position_start[0] : (self.body_position_end[0] + 1)]
|
28
|
+
)
|
29
|
+
output = output[self.body_position_start[1] :]
|
30
|
+
output = r.sub(_BODY_END_PATTERN, "", output, count=1)
|
31
|
+
|
32
|
+
return output.strip()
|
33
|
+
|
34
|
+
@property
|
35
|
+
def body_as_text(self) -> str:
|
36
|
+
""""""
|
37
|
+
return "".join(self.pieces).strip()
|
38
|
+
|
34
39
|
def __post_init__(self) -> None:
|
35
40
|
""""""
|
36
|
-
|
41
|
+
base_t.__init__(self)
|
37
42
|
self.source = self.source.strip()
|
38
43
|
self.feed(self.source)
|
39
44
|
|
@@ -54,68 +59,6 @@ class html_reader_t(html_parser_t):
|
|
54
59
|
if self.inside_body:
|
55
60
|
self.pieces.append(data)
|
56
61
|
|
57
|
-
@property
|
58
|
-
def body(self) -> str:
|
59
|
-
""""""
|
60
|
-
output = self.source.splitlines()
|
61
|
-
output = "\n".join(
|
62
|
-
output[self.body_position_start[0] : (self.body_position_end[0] + 1)]
|
63
|
-
)
|
64
|
-
output = output[self.body_position_start[1] :]
|
65
|
-
output = r.sub(_BODY_END_PATTERN, "", output, count=1)
|
66
|
-
|
67
|
-
return output.strip()
|
68
|
-
|
69
|
-
@property
|
70
|
-
def body_as_text(self) -> str:
|
71
|
-
""""""
|
72
|
-
return "".join(self.pieces).strip()
|
73
|
-
|
74
|
-
|
75
|
-
def SaveLOGasHTML(path: str | path_t | io_base_t | None = None) -> None:
|
76
|
-
"""
|
77
|
-
From first console handler found.
|
78
|
-
"""
|
79
|
-
cannot_save = "Cannot save logging record as HTML"
|
80
|
-
|
81
|
-
if console_t is None:
|
82
|
-
L.warning(f"{cannot_save}: The Rich console cannot be imported.")
|
83
|
-
return
|
84
|
-
|
85
|
-
if path is None:
|
86
|
-
for handler in L.handlers:
|
87
|
-
if isinstance(handler, l.FileHandler):
|
88
|
-
path = path_t(handler.baseFilename).with_suffix(".htm")
|
89
|
-
break
|
90
|
-
if path is None:
|
91
|
-
L.warning(f"{cannot_save}: No file handler to build a filename from.")
|
92
|
-
return
|
93
|
-
if path.exists():
|
94
|
-
L.warning(
|
95
|
-
f'{cannot_save}: Automatically generated path "{path}" already exists.'
|
96
|
-
)
|
97
|
-
return
|
98
|
-
elif isinstance(path, str):
|
99
|
-
path = path_t(path)
|
100
|
-
|
101
|
-
actual_file = isinstance(path, path_t)
|
102
|
-
if actual_file and path.exists():
|
103
|
-
L.warning(f'{cannot_save}: File "{path}" already exists.')
|
104
|
-
return
|
105
|
-
|
106
|
-
for handler in L.handlers:
|
107
|
-
console = getattr(handler, "console", None)
|
108
|
-
if isinstance(console, console_t) and console.record:
|
109
|
-
html = console.export_html()
|
110
|
-
if actual_file:
|
111
|
-
with open(path, "w") as accessor:
|
112
|
-
accessor.write(html)
|
113
|
-
else:
|
114
|
-
path.write(html)
|
115
|
-
break
|
116
|
-
else:
|
117
|
-
L.warning(f"{cannot_save}: No handler has a RICH console with recording ON.")
|
118
|
-
|
119
62
|
|
120
63
|
"""
|
121
64
|
COPYRIGHT NOTICE
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
import logging as l
|
8
|
+
from io import IOBase as io_base_t
|
9
|
+
from pathlib import Path as path_t
|
10
|
+
|
11
|
+
from logger_36.instance.logger import L
|
12
|
+
|
13
|
+
|
14
|
+
def SaveLOGasHTML(path: str | path_t | io_base_t | None = None) -> None:
|
15
|
+
"""
|
16
|
+
From first console handler found.
|
17
|
+
"""
|
18
|
+
cannot_save = "Cannot save logging record as HTML"
|
19
|
+
|
20
|
+
if path is None:
|
21
|
+
for handler in L.handlers:
|
22
|
+
if isinstance(handler, l.FileHandler):
|
23
|
+
path = path_t(handler.baseFilename).with_suffix(".htm")
|
24
|
+
break
|
25
|
+
else:
|
26
|
+
L.warning(f"{cannot_save}: No file handler to build a filename from.")
|
27
|
+
return
|
28
|
+
|
29
|
+
if path.exists():
|
30
|
+
L.warning(
|
31
|
+
f'{cannot_save}: Automatically generated path "{path}" already exists.'
|
32
|
+
)
|
33
|
+
return
|
34
|
+
elif isinstance(path, str):
|
35
|
+
path = path_t(path)
|
36
|
+
|
37
|
+
actual_file = isinstance(path, path_t)
|
38
|
+
if actual_file and path.exists():
|
39
|
+
L.warning(f'{cannot_save}: File "{path}" already exists.')
|
40
|
+
return
|
41
|
+
|
42
|
+
html = L.past_logs_as_HTML
|
43
|
+
if html is None:
|
44
|
+
L.warning(f"{cannot_save}: No handler could provide an HTML output.")
|
45
|
+
else:
|
46
|
+
if actual_file:
|
47
|
+
with open(path, "w") as accessor:
|
48
|
+
accessor.write(html)
|
49
|
+
else:
|
50
|
+
path.write(html)
|
51
|
+
|
52
|
+
|
53
|
+
"""
|
54
|
+
COPYRIGHT NOTICE
|
55
|
+
|
56
|
+
This software is governed by the CeCILL license under French law and
|
57
|
+
abiding by the rules of distribution of free software. You can use,
|
58
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
59
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
60
|
+
"http://www.cecill.info".
|
61
|
+
|
62
|
+
As a counterpart to the access to the source code and rights to copy,
|
63
|
+
modify and redistribute granted by the license, users are provided only
|
64
|
+
with a limited warranty and the software's author, the holder of the
|
65
|
+
economic rights, and the successive licensors have only limited
|
66
|
+
liability.
|
67
|
+
|
68
|
+
In this respect, the user's attention is drawn to the risks associated
|
69
|
+
with loading, using, modifying and/or developing or reproducing the
|
70
|
+
software by the user in light of its specific status of free software,
|
71
|
+
that may mean that it is complicated to manipulate, and that also
|
72
|
+
therefore means that it is reserved for developers and experienced
|
73
|
+
professionals having in-depth computer knowledge. Users are therefore
|
74
|
+
encouraged to load and test the software's suitability as regards their
|
75
|
+
requirements in conditions enabling the security of their systems and/or
|
76
|
+
data to be ensured and, more generally, to use and operate it in the
|
77
|
+
same conditions as regards security.
|
78
|
+
|
79
|
+
The fact that you are presently reading this means that you have had
|
80
|
+
knowledge of the CeCILL license and that you accept its terms.
|
81
|
+
|
82
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
83
|
+
|
84
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
85
|
+
member of team Morpheme.
|
86
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
87
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
88
|
+
I3S, and Laboratory iBV.
|
89
|
+
|
90
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
91
|
+
Inria: https://www.inria.fr/en/
|
92
|
+
UniCA: https://univ-cotedazur.eu/
|
93
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
94
|
+
I3S: https://www.i3s.unice.fr/en/
|
95
|
+
iBV: http://ibv.unice.fr/
|
96
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
97
|
+
"""
|
@@ -102,6 +102,18 @@ class logger_t(base_t):
|
|
102
102
|
""""""
|
103
103
|
return self.staged_issues.__len__() > 0
|
104
104
|
|
105
|
+
@property
|
106
|
+
def past_logs_as_HTML(self) -> str | None:
|
107
|
+
"""
|
108
|
+
From the first handler found with the given functionality, if any.
|
109
|
+
"""
|
110
|
+
for handler in self.handlers:
|
111
|
+
past_logs_as_HTML = getattr(handler, "past_logs_as_HTML", None)
|
112
|
+
if past_logs_as_HTML is not None:
|
113
|
+
return past_logs_as_HTML
|
114
|
+
|
115
|
+
return None
|
116
|
+
|
105
117
|
@property
|
106
118
|
def max_memory_usage(self) -> int:
|
107
119
|
""""""
|
@@ -338,6 +350,7 @@ class logger_t(base_t):
|
|
338
350
|
if state:
|
339
351
|
assert not self.intercepts_logs
|
340
352
|
|
353
|
+
# Note: Alternative to self.manager is logging.root.manager.
|
341
354
|
all_loggers = [l.getLogger()] + [
|
342
355
|
l.getLogger(_nme)
|
343
356
|
for _nme in self.manager.loggerDict
|
@@ -45,6 +45,7 @@ package/logger_36/constant/message.py
|
|
45
45
|
package/logger_36/constant/path.py
|
46
46
|
package/logger_36/constant/record.py
|
47
47
|
package/logger_36/constant/system.py
|
48
|
+
package/logger_36/extension/html_.py
|
48
49
|
package/logger_36/instance/logger.py
|
49
50
|
package/logger_36/instance/loggers.py
|
50
51
|
package/logger_36/task/inspection.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|